Skip to content

How to consume an provider API after user logged in #563

Answered by tesharp
MatteoGauthier asked this question in Help
Discussion options

You must be logged in to vote

You can also add it to the session in callback. Session already have a property for accessToken. Then it is available client side if you need to send to some apis

callbacks: {
    session: async (session, user: any) => {
      session.accessToken = user.accessToken;
      return Promise.resolve(session)
    },
    jwt: async (token, user, account, profile, isNewUser) => {
        const isSignIn = (user) ? true : false
        if (isSignIn) {
            token.accessToken = account.accessToken;
        }
        return Promise.resolve(token)
    }
  }

Replies: 11 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by MatteoGauthier
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
8 participants
Converted from issue

This discussion was converted from issue #563 on December 18, 2020 10:02.