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:

Radix Ui Adoption Guide Overview Examples And Alternatives

Radix UI adoption guide: Overview, examples, and alternatives

Radix UI is quickly rising in popularity and has become an excellent go-to solution for building modern design systems and websites.

Nefe Emadamerho-Atori
Apr 25, 2024 â‹… 11 min read
Understanding The Css Revert Layer Keyword, Part Of Css Cascade Layers

Understanding the CSS revert-layer keyword

In this article, we’ll explore CSS cascade layers — and, specifically, the revert-layer keyword — to help you refine your styling strategy.

Chimezie Innocent
Apr 24, 2024 â‹… 6 min read
Exploring Nushell, A Rust Powered, Cross Platform Shell

Exploring Nushell, a Rust-powered, cross-platform shell

Nushell is a modern, performant, extensible shell built with Rust. Explore its pros, cons, and how to install and get started with it.

Oduah Chigozie
Apr 23, 2024 â‹… 6 min read
Exploring Zed, A Newly Open Source Code Editor Written In Rust

Exploring Zed, an open source code editor written in Rust

The Zed code editor sets itself apart with its lightning-fast performance and cutting-edge collaborative features.

Nefe Emadamerho-Atori
Apr 22, 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