Skip to content
Discussion options

You must be logged in to vote

just simplify to one if statement with if(account)

This should work:

async jwt({ token, account }) {
  if (account) {
    token[account.provider] = {
      accessToken: account.access_token,
      refreshToken: account.refresh_token,
    }
  }

  return token
}

Furthermore, to make TS happy, check out the docs at: https://next-auth.js.org/getting-started/typescript#submodules

declare module "next-auth/jwt" {
  interface JWT {
    [key: string]: {
      accessToken: string
      refreshToken: string
    }
  }
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@deadcoder0904
Comment options

Answer selected by deadcoder0904
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants