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:

Rxjs Adoption Guide: Overview, Examples, And Alternatives

RxJS adoption guide: Overview, examples, and alternatives

Get to know RxJS features, benefits, and more to help you understand what it is, how it works, and why you should use it.

Emmanuel Odioko
Jul 26, 2024 â‹… 13 min read
Decoupling Monoliths Into Microservices With Feature Flags

Decoupling monoliths into microservices with feature flags

Explore how to effectively break down a monolithic application into microservices using feature flags and Flagsmith.

Kayode Adeniyi
Jul 25, 2024 â‹… 10 min read
Lots of multi-colored blue and purplish rectangles.

Animating dialog and popover elements with CSS @starting-style

Native dialog and popover elements have their own well-defined roles in modern-day frontend web development. Dialog elements are known to […]

Rahul Chhodde
Jul 24, 2024 â‹… 10 min read
Using Llama Index To Add Personal Data To Large Language Models

Using LlamaIndex to add personal data to LLMs

LlamaIndex provides tools for ingesting, processing, and implementing complex query workflows that combine data access with LLM prompting.

Ukeje Goodness
Jul 23, 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