nextauthjs / nextauthjs/next-auth
Sveltekit session update
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28.4k
- Forks
- 4k
- PR merge metrics
- No merged PRs in 30d
Description
Description 📓
I'm working in a project where the user can sign in with two options: Azure and Credentials. When the user sign in using credentials, I want to give the option to change the username and update the session. Is there an implementation in sveltekit to do this?
Looking in the source code of the file /node_modules/@auth/core/src/lib/routes/session.ts, it seems like the update function could be implemented
const token = await callbacks.jwt({
token: decodedToken,
...(isUpdate && { trigger: "update" }),
session: newSession,
})
The trigger would have the "update" value and I could replace the username in the jwt callback, just like in next-auth. Also, looking at /node_modules/@auth/sveltekit/index.js seems to be the place where I could expose the update function to the client. However, I'm lost at how to do this.
Is there a way to implement it?
How to reproduce ☕️
nil
Contributing 🙌🏽
No, I am afraid I cannot help regarding this
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 by reading /node_modules/@auth/core/src/lib/routes/session.ts and /node_modules/@auth/sveltekit/index.js, focusing on the requested session update flow and client exposure. Done would require determining whether this SvelteKit capability is supported and defining a clear implementation or response path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100