Open ffxsam opened 6 years ago
Aha. cognitoUser.refreshSession()
is not documented.
This is hacky, but I set up a 30-min timer to auto refresh the ID & access tokens. If there's a better way, I'm all ears.
You can basically wrap your calls in a call to getSession in which case the SDK always checks if the access token is valid and if not it uses the refresh token to retrieve a new access token.
(side note: I hope someone is working on the documentation for this repo.. a bunch of use cases in the README doesn't cut it)
I have an app where a user might be using it for well over an hour. During that time, the ID and access tokens expire, and errors are thrown when trying to access AWS services that expect the user to be authorized via Cognito.
How/when do we properly detect expiration? And how do we refresh those tokens seamlessly so the user doesn't experience any interruptions?