2023-02-06
2299
#aws#svelte
Zain Sajjad
158161
110
Feb 6, 2023 â‹… 8 min read

SvelteKit Auth with AWS Cognito

Zain Sajjad Head of Product Experience at Peekaboo Guru. In love with mobile machine learning, React, React Native, and UI designing.

Recent posts:

Building a Full-Featured Laravel Admin Dashboard with Filament

Building a full-featured Laravel admin dashboard with Filament

Build scalable admin dashboards with Filament and Laravel using Form Builder, Notifications, and Actions for clean, interactive panels.

Kayode Adeniyi
Dec 20, 2024 â‹… 5 min read
Working With URLs In JavaScript

Working with URLs in JavaScript

Break down the parts of a URL and explore APIs for working with them in JavaScript, parsing them, building query strings, checking their validity, etc.

Joe Attardi
Dec 19, 2024 â‹… 6 min read
Lazy Loading Vs. Eager Loading

Lazy loading vs. Eager loading

In this guide, explore lazy loading and error loading as two techniques for fetching data in React apps.

Njong Emy
Dec 18, 2024 â‹… 5 min read
Deno logo over an orange background

How to migrate your Node.js app to Deno 2.0

Deno is a popular JavaScript runtime, and it recently launched version 2.0 with several new features, bug fixes, and improvements […]

Yashodhan Joshi
Dec 17, 2024 â‹… 7 min read
View all posts

13 Replies to "SvelteKit Auth with AWS Cognito"

  1. Attempting to follow along with this guide and receive the following error when using the signIn function

    Error: Not found: /auth/csrf
    at resolve (/node_modules/@sveltejs/kit/src/runtime/server/respond.js:395:13)
    at resolve (/node_modules/@sveltejs/kit/src/runtime/server/respond.js:236:5)
    at Object.#options.hooks.handle (/node_modules/@sveltejs/kit/src/runtime/server/index.js:41:55)
    at Module.respond (/node_modules/@sveltejs/kit/src/runtime/server/respond.js:233:40)
    at runMicrotasks ()
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

    Just wondering if there was some type of config I missed or if there is a problem with the package itself. I know it is experimental but would expect a core feature to work.

    1. Mhhh that’s weird. I managed to have the library working. I twisted and adapted the tutorial to fit my project though.

      Is there any thing you changed?
      Maybe try deleting Cookies or try another browser just to test

  2. Awesome content!
    However, some info are missing about “import type AuthUser from “$lib/domains/auth/types/AuthUser”;”

  3. You could also precise for “import { AUTH_SECRET } from “$env/static/private”;”

    But really small details. Still going over the article. Thanks a lot, it’s perfect timing for me.

    1. Is this supposed to be configured for login with client id and secret, or just the client id? Which auth flow do you use? You mention using the AUTH_SECRET, so I’m assuming its using both the client id and secret. Also, I was using the Cognito provider for Auth.js, but I would like to stop using the Cognito Hosted UI, and switch to something like this instead.

      1. Ah, nevermind. I changed my client to not require a secret and it worked.
        I still don’t know where you define the
        `import { getAccount } from ‘$lib/auth/api/getAccount’;`
        There is no such file at this location :/

          1. could you explain further? I followed all your steps, but I am still getting this error. What should I be defining?

  4. When running the command
    pnpm install @auth/sveltekit@next @auth/core@next
    I get an error
    ERR_PNPM_NO_MATCHING_VERSION  No matching version found for @auth/sveltekit@next

    The only way I could get it to run was using the command:
    pnpm install @auth/sveltekit@’0.3.0′ @auth/core@’0.3.0′

    @auth/core is at V 0.12.0

Leave a Reply