Logout issue regarding access token expiry in React native App

Viewed 144

I am working on a react native app that has a PHP backend. I am getting an issue with OAuth2. Following is the scenario.

  1. User enters the login screen, he will get an access token. Which is saving in async storage.

  2. Whenever the user is successfully identified, the auth service provider issues an access_token and refresh_token

  3. The app uses the access token to fetch more user information.

  4. access token is expired. Then I got into the app and closed sooner(which will send a request for a new access token but upon closing the app, the response won't be stored in the device, rather it will update the backend refresh token). This causes refresh token mismatch and lead to app log out.

  5. When I'm trying to open the app I get thrown out and I need to log in again due to the mismatch of refresh token at backend and async storage.

Any ideas are welcome!

0 Answers
Related