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
Asked
Active
Viewed 3,036 times
1 Answers
2
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)

oriharel
- 10,418
- 14
- 48
- 57
-
I am using Auth.currentSession() from amplify. But occasionally I am facing the 401 message as Your token has expired in my react-native app. Here I am using the jwt token from the response. Any thoughts about this? – sejn Jun 02 '20 at 09:04
-
@oriharel did you find a solution for that issue? I got auth event "tokenRefresh_failure" but not sure how to force Amplify wrapper to show the login page – demsey Mar 15 '22 at 06:06
-
This is actually not an answer, it does not advise how to solve the problem, how did it get marked as the answer and given 2 upvotes, How are we meant to use this???? – TheArchitecta Jul 14 '23 at 05:27
-
How to re-login, what is the process? Access Id, Secret Key and Session Toekn should be all we need to use amplify command. – TheArchitecta Jul 14 '23 at 05:29