question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[identity] Token expired from managed identity seems to never be refreshed

See original GitHub issue
  • Package Name: @azure/identity
  • Package Version: 3.1.1
  • Operating system: Windows
  • nodejs
    • version: 14.20.0

Describe the bug Since the switch to version 3.1.1 of the library we notice that after about 24 hours it is no longer possible to retrieve information on a KeyVault, App Config, … The error received is that the token has expired as if it was never refresh. For example, we use the ApiManagementClient to communicate with the APIM. When we make a call to list the users registered on the instance we get this error (only after 24 hours without restarting the process): "The access token expiry UTC time ‘12/1/2022 4:31:31 PM’ is earlier than current UTC time ‘12/1/2022 5:13:12 PM’.

this.client = new ApiManagementClient(
            new DefaultAzureCredential(),
            this._subscriptionId,
            { credentialScopes: 'https://management.azure.com/.default' }
)

// 24 hours later
this.client.user.listByService(<resourceGroupName>, <apimName>)

This problem seems to only happen on App Services where we use man

Expected behavior The token should be refreshed automatically to avoid expired token

Additional context After some further research we noticed a change that was made in version 3.1.1 of the library in data returned when retrieving token from managed identity credentials : https://github.com/Azure/azure-sdk-for-js/pull/23920/files

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mstefflcommented, Dec 9, 2022

I can also confirm. Since 2 days of usage of 3.1.2 no more expired token

1reaction
patrickdassiercommented, Dec 9, 2022

@KarishmaGhiya : After one day and a half of test, I can confirm that the issue is solved. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - How to handle expired ManagedIdentity token in case of ...
There's currently no way to force a token refresh. The service provider sets the cache duration of the token generated by a Managed...
Read more >
Azure AD refresh token is getting invalid frequently
This error is due to when refresh token can be expired due to either if the password changed for the user or the...
Read more >
Solved: OAuth Refresh token has expired after 90 days
The Microsoft documentation https://docs.microsoft.com/en-us/graph/auth-overview says that an OAuth Refresh token should only expired if it has been inactive ...
Read more >
Configure Refresh Token Expiration - Auth0
Enter Absolute Lifetime in seconds. The refresh token expires after the specified interval and can no longer be used to get a new...
Read more >
Using OAuth 2.0 to Access Google APIs | Authorization
Once the access token expires, the application uses the refresh token to ... In these situations your application needs to prove its own...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found