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:

Solving The Node.js Console.Time Is Not A Function Error

Solving the Node.js console.time is not a function error

Explore the two variants of the `console.time is not a function` error, their possible causes, and how to debug.

Joseph Mawa
Nov 1, 2024 â‹… 6 min read
Why jQuery 4 Is A Good Reminder To Stop Using jQuery

Why jQuery 4 is a good reminder to stop using jQuery

jQuery 4 proves that jQuery’s time is over for web developers. Here are some ways to avoid jQuery and decrease your web bundle size.

Shalitha Suranga
Oct 31, 2024 â‹… 11 min read
How to Create a Multilevel Dropdown Menu in React

How to create a dropdown menu in React

See how to implement a single and multilevel dropdown menu in your React project to make your nav bars more dynamic and user-friendly.

Ibadehin Mojeed
Oct 30, 2024 â‹… 12 min read
Purple background with different connections between icons for an article about building Node.js modules with Rust and NAPI-RS.

Building Node.js modules in Rust with NAPI-RS

NAPI-RS is a great module-building tool for image resizing, cryptography, and more. Learn how to use it with Rust and Node.js.

Rahul Padalkar
Oct 30, 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