nextauthjs / nextauthjs/next-auth
SvelteKit: prefix not supported in @auth/sveltekit/client
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28.4k
- Forks
- 4k
- PR merge metrics
- No merged PRs in 30d
Description
Environment
System:
OS: macOS 13.1
CPU: (10) arm64 Apple M1 Max
Memory: 7.74 GB / 64.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.17.0/bin/yarn
npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
Reproduction URL
https://github.com/markjaquith/sveltekit-auth-prefix-bug
Describe the issue
prefix is not fully supported. The client code from @auth/sveltekit/client for signIn and signOut have the prefix hardcoded as /auth, and thus do not work on a site where a prefix is configured.
How to reproduce
Set a prefix:
SvelteKitAuth({
providers: [GitHub({ clientId: GITHUB_ID, clientSecret: GITHUB_SECRET })],
prefix: '/prefix/auth',
})
Attempt to log in using logIn from @auth/sveltekit/client. See that the browser is attempting to communicate with /auth/csrf which does not exist — should be /prefix/auth/csrf
Manually log in by going to /prefix/auth/signin.
Attempt to log out using logOut from @auth/sveltekit/client. See that the browser is attempting to communicate with /auth/csrf which does not exist — should be /prefix/auth/csrf
Expected behavior
prefix should be fully supported.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the @auth/sveltekit/client implementations of signIn and signOut, then reproduce the issue using the linked sveltekit-auth-prefix-bug project with prefix set to /prefix/auth. Trace the requests to the CSRF endpoint and confirm that both client operations use the configured prefix rather than /auth.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, typescript
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100