Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorize()'s refreshToken expiry #1018

Open
captainalbert opened this issue Sep 5, 2024 · 4 comments
Open

Authorize()'s refreshToken expiry #1018

captainalbert opened this issue Sep 5, 2024 · 4 comments

Comments

@captainalbert
Copy link

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
@carbonrobot
Copy link
Contributor

The expiration times of tokens are controlled by your provider, in this case Azure. Try inspecting both tokens by pasting them into https://jwt.io/ and looking at the data inside the token, which could be helpful in determining the problem. The iat property in the payload is the time it was issued, and the exp property is the expiration.

@captainalbert
Copy link
Author

The expiration times of tokens are controlled by your provider, in this case Azure. Try inspecting both tokens by pasting them into https://jwt.io/ and looking at the data inside the token, which could be helpful in determining the problem. The iat property in the payload is the time it was issued, and the exp property is the expiration.

I've tried inspecting the refreshToken via https://jwt.io but it returns this invalid payload.
image

@carbonrobot
Copy link
Contributor

The data you posted looks like an access exchange token and not a JWT, or possible an encrypted JWT.

What does your configuration for RNAA look like?

@captainalbert
Copy link
Author

This is my config
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants