Looking for NextAuth Discord Refresh token rotation examples. All mine have expired.
I have created a project that uses Discord as a provider.
My
refresh_token
and access_token
's have expired, I've noticed when sign in is performed, it doesn't automatically refresh these details and thus access to oauth with Discord has dropped.
I am looking for an implementation that updates these details on signIn. I've found the Google example on the NextAuth (https://authjs.dev/guides/basics/refresh-token-rotation) guide but as it only includes Google and I'm not the brightest, I am looking to do Discord but do it correctly, as login is not something to mess up!
Thanks anyone who can help me out ๐Refresh token rotation | Auth.js
Refresh token rotation is the practice of updating an accesstoken on behalf of the user, without requiring interaction (eg.: re-sign in). accesstokens are usually issued for a limited time. After they expire, the service verifying them will ignore the value. Instead of asking the user to sign in again to obtain a new accesstoken, certain provide...
5 Replies
oAuth standard is the same, you should be able to use the same code for discord
I've attempted this but keep getting the same issue.
If a user's access_token or refresh_token has expired, it loops login (using the example on the page I posted).
I'm confused why it doesn't re-authenticate the details and update them if the previous ones have expired.
https://github.com/nextauthjs/next-auth/issues/3599 I'm not crazy! Seems like an issue ongoing?
GitHub
Subsequent sign ins do not update account ยท Issue #3599 ยท nextauthj...
Description ๐ On first sign in, an account is "linked" (created) for a user. On subsequent sign ins, the account is not updated. Since the access_token for a provider is stored as part of...
hey @debaucus , did you manage to find an implementation?
@hyperzone my main solition was to trigger a re-auth on login and store the new key.