nextauthjs / nextauthjs/next-auth

Sveltekit session update

Open
#7,722 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement triage
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.