FormidableLabs / FormidableLabs/react-native-app-auth

Authorize()'s refreshToken expiry

Open
#1,018 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.3k
Forks
473
PR merge metrics
No merged PRs in 30d

Description

## Issue

Hi, I've read the documentation for authorization function of this library (https://commerce.nearform.com/open-source/react-native-app-auth/docs/usage/authorization).
The response contains the expiration only for the accessToken and not for the refreshToken. Can you tell how much time does the refreshToken has before it expires as well?

I am asking because currently I am in a situation that I need the refreshToken from authorize(config) to be used on refresh() like the next code snippet for my Azure Active Directory login.

`// Refresh token`
`const refreshedState = await refresh(config, {
refreshToken: authState.refreshToken,
});`

But the problem is, when I use the `authState.refreshToken` when the `authState.accessToken` from authorize(config) has expired, refresh(config) fails. But as long as the `authState.accessToken` is not yet expired, the refresh(config) call returns a successful response.

I'm thinking if the `authState.refreshToken` is being expired the same time as `authState.accessToken`. Because refresh(config) fails only when the `authState.accessToken` has expired.

---

## Environment

* **Your Identity Provider**: Azure
* **Platform that you're experiencing the issue on**: Tested on Android only yet
* **Your `react-native` Version**: 0.69.2
* **Your `react-native-app-auth` Version**: 6.0.2
* **Are you using Expo?** No

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.