I'm working on a React Native application. When the React Native is app is brought to the foreground after a while, multiple functionalities will call its corresponding APIs to update the results. However, when the access token is expired, the APIs will return 403 error.

When the token has expired, Access token API will be called to get the latest Access token post which the corresponding APIs are called. When there are 'N' number of APIs, the 'Access token API' will be called 'N' times.

I want to avoid this situation. Just call the 'Access token API' once irrespective of the number of APIs that uses Access token. Once the Access token is updated, all the corresponding APIs can be called to completed their respective functionalities.

Are there any React-Native libraries that could be of help? If not, what would be the approach to handle this scenario?

I'm new to React and hence haven't tried any solutions.


0 Answers