This repository is an example for setting up lucia-sveltekit
with prisma
, using planetscale
as it's database host.
Currently, requests which are validated with auth.validateRequest(request)
error with AUTH_INVALID_ACCESS_TOKEN
.
.env
file.npm i && npx prisma db push && npx prisma generate
npm run dev
/
should return User data after authenticated, instead returns AUTH_INVALID_ACCESS_TOKEN
error.This is a minimal setup following the email & password directions from lucia-sveltekit's Email and Password guide + lucia-sveltekit's Prisma Adapter guide. I first encountered this issue in another project with more complexity, and wanted to see if I could reproduce it in a minimal environment.
The project has 3 pages, and 3 api routes. The API routes are the following:
/api/sign-up
: Handles user sign up
/api/login
: Handles user login
/api/check-auth
: Simple endpoint which will call auth.validateRequest(request)
and either return validateRequest
's return value or an error message.
The pages are as follows:
/sign-up
: Allows user to sign up, redirects to /
on success
/login
: Allows user to login, redirects to /
on success
/
: Calls the /api/check-auth
endpoint and renders the response data