Search code examples
amazon-web-servicesreact-nativeexpoamazon-cognitoaws-amplify

AWS Amplify "Refresh Token has expired" after less than configured time (30 days)


I'm using React Native and Expo. Also using aws-amplify to manage users with Cognito's user pool. Every so often my users are getting kicked out of the system because of "Refresh Token has expired" error. Those users were in the system in the previous week so their refresh token should still be valid. Any ideas? I'm using: aws-amplify 2.2.0 aws-amplify-react-native 2.2.3 react-native 0.59 expo 35


Solution

  • I think this is a misunderstanding of the docs. I was under the impression that the refresh token is being re-issued on every session, thus users should never get to the expiration time while they are active. Apparently this is not the case, as users are issued a refresh token upon login only and that token is being persistent on the client side storage. No matter if they are active or not, this token is expired after 30 days (or else configured) and then need to re-login again.

    (of course I'm aware that this is not an Amplify implementation)