-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v4: Bring back the ability to pass refresh: true to getAccessToken #1884
Comments
As a followup, I found a workaround for the issue as described above. basically the idea is to update the session to make it look like the token has expired, then call
However, there is a new issue. I would also like the user info (as retrieved from the ID token) to be updated. In v3, this happened when the access token was refreshed. However, in v4 this does not seem to happen, and looking at the code, it makes sense: in v3, it parsed out the id token from the oauth endpoint response for token refresh and updated Can we bring this back? The motivation is - I display user info like name, email, etc which I get from I could probably make a workaround, where I also update the email/name/etc in the session directly when the user uses the "update email/name/etc" functionality. and this may even be better as an "optimistic update". but it still feels like refreshing the access token should also update the user info from the id token (or at least there should be an option to do make it so) |
I am migrating an application from Next14 with Auth0 3.6.0. to Next 15 and V4.0.0-beta.14. I am having a similar issue. IssueWhen we create accounts with Username and Password, by default V3When using V3, I have the code below in 'update-session': handleProfile({ refetch: true }),
logout: handleLogout({
returnTo: '/',
}), |
I would be interested in a solution for this as well. I haven't yet started the migration to v4 yet, but in current v3, I am doing something similar for
'update-me': async function updateSession(req: NextApiRequest, res: NextApiResponse) {
return handleMeProfile(req, res, true)
}, and on my <UserProvider profileUrl="/api/auth/update-me">
<!--children here-->
</UserProvider> I would hope there is a way to force a refresh of the token or at least the accessible user profile info to attain an up to date value for |
Checklist
Describe the problem you'd like to have solved
In v3, when calling
getAccessToken
, it was possible to pass{ refresh: true }
to force the access token to be refreshed even if it had not yet expired.This is useful in contexts when you know that something about the user has been updated in auth0 that would cause the access token to be different, and you would like to retrieve an updated token that reflects the changes. An example would be:
In v4, I am not seeing this option, or any way of replicating this functionality.
Describe the ideal solution
Re-introduce the optional
{ refresh?: boolean }
parameter togetAccessToken()
- if set to true (and refresh token exists) it will always request a new token before returning it, even if current token exists and is not expired.Alternatives and current workarounds
I haven't found a workaround yet, the relevant code seems to be in
get-access-token.ts
and there is no way to inject the desired behavior.Additional context
No response
The text was updated successfully, but these errors were encountered: