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:

Rust logo over black marble background.

Handling memory leaks in Rust

Learn how to manage memory leaks in Rust, avoid unsafe behavior, and use tools like weak references to ensure efficient programs.

Ukeje Goodness
Nov 20, 2024 â‹… 4 min read
Robot pretending to be a person.

Using curl-impersonate in Node.js to avoid blocks

Bypass anti-bot measures in Node.js with curl-impersonate. Learn how it mimics browsers to overcome bot detection for web scraping.

Antonello Zanini
Nov 20, 2024 â‹… 13 min read
Solving Eventual Consistency In Frontend

Solving eventual consistency in frontend

Handle frontend data discrepancies with eventual consistency using WebSockets, Docker Compose, and practical code examples.

Kayode Adeniyi
Nov 19, 2024 â‹… 6 min read
How To Use Lazy Initialization Pattern With Rust 1.80

How to use the lazy initialization pattern with Rust 1.80

Efficient initializing is crucial to smooth-running websites. One way to optimize that process is through lazy initialization in Rust 1.80.

Yashodhan Joshi
Nov 18, 2024 â‹… 5 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