Getting new refresh_token from an OAuth provider, infinite login loop #11545
Unanswered
angelahnicole
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background info:
database
session strategy with the DynamoDB adapterAnd here is some relevant version information:
My problem is how to gracefully handle an
invalid_grant
error when therefresh_token
expires, as redirecting the user to sign-in when this occurs results in an infinite loop since I don't thinkNextAuth.js
is actually updating therefresh_token
when you log in again.And, from a comment in the OAuth code, it seems to confirm that maybe the token information / account information may not be touched by NextAuth.js after creation: https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/oauth.ts#L156.
My "solution" is to delete the user entirely in my session callback if Okta returns
invalid_grant
, as this results in getting a newrefresh_token
but that seems like a horrible workaround.Is there a better way to do this within
NextAuth.js
, or is it simply not supported?Beta Was this translation helpful? Give feedback.
All reactions