Skip to content

How To read all claims from user #9947

Closed Answered by ThangHuuVu
yordis asked this question in Help
Discussion options

You must be logged in to vote

hi @yordis, to pass the claims to the session, you need to use the jwt callback and session callback - see the doc here: https://authjs.dev/guides/basics/callbacks#jwt-callback

I suppose you can do something like this:

callbacks: {
    jwt({ token, trigger, session, account }) {
      token.foo = account.foo // or any fields you want
      return token
    },
    session({ session, token }) {
      session.foo = token.foo
      return session
    }
  },

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@yordis
Comment options

@ThangHuuVu
Comment options

Answer selected by yordis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
docs Relates to documentation triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
2 participants
Converted from issue

This discussion was converted from issue #9945 on February 07, 2024 13:46.