Description
Checklist
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
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:
- you use the access token to call an API that checks for certain claims or permissions
- you've updated the user in auth0 via management api to give the new permissions
- now you need to refresh the access token so it reflects those new permissions before calling the API.
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 to getAccessToken()
- 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