When and how is a refresh token extended?

Sato 20 Reputation points
2024-05-13T03:21:56.8133333+00:00

According to a https://learn.microsoft.com/en-us/entra/identity-platform/refresh-tokens, Refresh tokens replace themselves with a fresh token upon every use.

I believed we can continue using a refresh token if we keep refreshing the access token with the refresh token forever, but it was not correct.

We are using refresh token by below step

  1. Our user logs in to a client app with OAuth 2.0 of Microsoft Graph. The client app obtains a refresh token A and an access token.
  2. The client app refreshes access token with the refresh token A before expiration of the access token. The authentication returns a new refresh token B and a new access token. Our client app keep using the refresh token A, so it store only the new access token.
  3. The client app continues to do 1&2 and sometimes called Graph API with an access token while the user continues to use our app for 90 days.
  4. When the client refresh an access token, API returns "AADSTS700082: The refresh token has expired due to inactivity".

Do we need to replace the refresh token A by new one (refresh token B) by myself?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,849 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,859 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yakun Huang-MSFT 785 Reputation points Microsoft Vendor
    2024-05-16T07:05:00.3066667+00:00

    Hi @Sato

    Yes, you need to use refresh token B to replace refresh token A, because the maximum lifetime of refresh token is 90 days, and this time cannot be modified, so when you keep using refresh token A, the token will expire after 90 days, so you need to use the newly obtained refresh token B to replace refresh token A. By analogy, you can continue to obtain refresh token C and new access token through refresh token B, then you need to replace refresh token B with refresh token C, so that you can always use new refresh tokens instead of old refresh tokens to prevent errors caused by refresh token expiration.

    Screenshot 2024-05-16 135953

    Screenshot 2024-05-16 140044

    More information about refresh token:

    https://learn.microsoft.com/en-us/entra/identity-platform/refresh-tokens

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


0 additional answers

Sort by: Most helpful