isotoma / react-cognito

Library for integrating Facebook React and Amazon Cognito
Apache License 2.0
116 stars 48 forks source link

Expired session and refreshing / CognitoState #43

Open davegravy opened 6 years ago

davegravy commented 6 years ago

After 1 hour (configurable in user pool) tokens expire yet CognitoState.LOGGED_IN remains true.

This necessitates complicated logic in the app, i.e checking cognito.user.signInUserSession.idToken.payload.exp at each PrivateRoute change and calls to private APIs, and subsequently attempting a refresh if the checks fail.

Would it be possible for react-cognito to auto-refresh tokens and update CognitoState if the refresh fails?