account.access_token
& account.refresh_token
is undefined
when using Twitter Provider with next-auth
?
#2966
-
I am following this tutorial & am unable to get the value of callbacks: {
async jwt({ token, account, user }) {
if (account) {
token[account.provider] = {
accessToken: account.access_token,
refreshToken: account.refresh_token,
}
console.log(token[account.provider])
}
return token
},
}, It currently logs This is how it's shown in the docs when using jwt callbacks but it's not working for me. I have made a complete reproduction on branch |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
@balazsorban44 I have asked about this on Reddit /r/nextjs as well & I don't think anyone is able to make it work even though it worked with v3. Maybe it's a bug. Can you @ someone who is familiar with Twitter Oauth API with |
Beta Was this translation helpful? Give feedback.
-
this isn't a bug. there is no access or refresh tokens in case of Twitter, please refer to our previous discussions. (I cannot find them to link to right now) |
Beta Was this translation helpful? Give feedback.
-
So the callbacks: {
async jwt({ token, account, user }) {
if (account) {
token[account.provider] = {
accessToken: account.oauth_token,
refreshToken: account.oauth_token_secret,
}
}
return token
},
}, |
Beta Was this translation helpful? Give feedback.
So the
access_token
got renamed tooauth_token
&refresh_token
got renamed tooauth_token_secret
: