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
For apps which are designed around the user being offline frequently, the following flow would be great:
- user is logged in
- user goes offline
- user returns to the app while offline, access token expired
- user can continue to browse the app with their identity in the state they last saw it
- upon coming back online, access token refresh happens
Currently, this is harder to achieve because credentials
of DefaultCredentialsManager
will always try to refresh the token, which fails without internet. Since this is the only method which access credentials, there is no way to just get the cached (expired) credentials. This would be convenient to have so that in the offline state, we can still restore the users id/roles/permissions as to what they should be able to view in that offline state.
Describe the ideal solution
Add a method to CredentialsManager
to get the cached credentials, without any attempt to refresh them. Or, add a boolean to the input of CredentialsManager.credentials
to do the same behavior.
Alternatives and current workarounds
Alternatively it would be possible to cache the users id/roles/permissions ourselves to use in the app during the offline state. But this would be redundant with the credentials already in the manager, if we could access them.
It would also be possible to write our own implementation of credentials manager, to returns expired credentials from credentials
if it fails to refresh while offline. But it defeats the purpose of the default manager to need to re-write the api calls to refresh the tokens and such
Additional context
No response