Microsoft-authentication-library-for-js: The acquireTokenSilent will always try to renew a new token instead of obtaining from the locale cache

Created on 20 Oct 2020  路  5Comments  路  Source: AzureAD/microsoft-authentication-library-for-js

Please follow the issue template below. Failure to do so will result in a delay in answering your question.

Library

Important: Please fill in your exact version number above, e.g. [email protected].

Framework

React

Description

  1. I first time logged in, and get the access token successfully by acquireTokenSilent method.
  2. Next, I found it always sends a request to STS to get a new token when the previous one is not expired.

Error Message

Below is the logs
image

Security

  • [ ] Is this issue security related?

Regression

  • [ ] Did this behavior work before?
    Version:

MSAL Configuration

// Provide configuration values here.
// For Azure B2C issues, please include your policies.

{
forceRefresh: false,
scopes: [ 'User.Read', 'User.Read.All']
}


## Reproduction steps
```js
// Provide relevant code snippets here.
// For Azure B2C issues, please include your policies.
  1. First call userAgentApplication.loginPopup() with the above parameter.
  2. Second time call userAgentApplication.acquireTokenSilent() with the above parameter, to check if it gets token successfully.
  3. Call userAgentApplication.acquireTokenSilent() with the above parameter again to check if it gets the cached token

    Expected behavior

It should not send request to STS to get a new token when the previous cached one is not expired.

Browsers/Environment

  • [ ] Chrome
  • [ ] Firefox
  • [x] Edge
  • [ ] Safari
  • [ ] IE
  • [ ] Other (Please add browser name here)
bug known-issue

All 5 comments

I noticed this too, @azure/[email protected]

Also noticed here, have had to fall back onto popups. Not really ideal.

Also noticed here, have had to fall back onto popups. Not really ideal.

I've fallbacked to 1.3.4, which works fine...

@kafka-yu closing since this is a known issue in [email protected] that is being addressed in #2376 and should be fixed in the 1.4.2 release. You can track progress in the original issue #2370. Thanks!

@hectormmg thanks

Was this page helpful?
0 / 5 - 0 ratings