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.

Token renewal operation failed due to timeout.

See original GitHub issue

Library versions)

  • react-aad-msal: 2.3.5 (latest) and 2.2.1
  • msal: 1.4.0 (latest) and 1.2.0

Describe the bug 1-10 minutes after the initial login, we and our clients get redirected to the Microsoft login screen. From there on the only way to login again is to delete the cookies. image

Additionally, the following error is logged multiple times to the console: MSAL Authentication Error! Error-Code: token_renewal_error | Error-Message: Token renewal operation failed due to timeout.

Interesting Notes

  1. Our react-msal setup worked fine for 5 months. Now from one day to another this error occurred. We didn’t modify the code or change any package versions.
  2. We experience this issue primarily on Firefox. Still some of our clients have reported this issue for Chrome.
  3. We upgraded both packages to the latest versions, as noted at the beginning. The issue remains.

Our Setup: Our setup is almost the same as described in your documentation.

  1. We have a static served auth.html.
  2. We have added both http://localhost:3000 and http://localhost:3000/auth.html to the Redirect URLs.
  3. This is our msal configuration:
import { MsalAuthProvider, LoginType } from 'react-aad-msal';
import { Logger, LogLevel } from 'msal';

const origin = "http://localhost:3000";
const config = {
    auth: {
      authority: 'https://login.microsoftonline.com/' + tenant,
      clientId: clientId,
      postLogoutRedirectUri: origin,
      redirectUri: origin,
      validateAuthority: true,
      navigateToLoginRequestUrl: false
    },
    system: {
      logger: new Logger(
        (logLevel, message, containsPii) => {
          console.log(logLevel, message);
        {
          level: LogLevel.Warning,
          piiLoggingEnabled: false
        }
      )
    },
    cache: {
      cacheLocation: 'localStorage', // we also tried 'sessionStorage',
      storeAuthStateInCookie: false
    }
  };

  const authenticationParameters = {
    scopes: ['openid']
  };

  const options = {
    loginType: LoginType.Redirect,
    tokenRefreshUri: origin + "/auth.html"
  };

  return new MsalAuthProvider(config, authenticationParameters, options);  // provider
  1. Then we use the provider from above like this:
<AzureAD provider={provider} forceLogin>
  ...
</AzureAD>

Desktop:

  • OS: Ubuntu
  • Browser Firefox and Chrome
  • Version 80.0 (Firefox)

I am grateful for any help. 😃

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

3reactions
ace-kay-law-neocommented, Sep 5, 2020

It’s pretty weird. I haven’t experienced this issue for one day. But now the token-renewal fails like before.

@AndrewCraswell could you please have a look on this?

2reactions
htariq-nisum-comcommented, Sep 3, 2020

I am also facing this issue, it seems like this library is using MSAL v1 endpoint which utilizes iframe to renew the tokens now discouraged by modern browsers. for this MSAL.js v2.0 endpoint was introduced to resolve it. checkout https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow

Read more comments on GitHub >

github_iconTop Results From Across the Web

Token renewal operation failed due to timeout MSAL Angular ...
Honestly I have no idea what I am missing or what I did wrong. In any of my code I am not doing...
Read more >
token renewal operation failed due to timeout MSAL #1592
Everything works fine except i keep getting an error token renewal operation failed due to timeout as soon as the token is expired....
Read more >
Token renewal operation failed due to timeout..
Hello -- does anyone know how to correct this issue? I am trying to export to Excel, and I am getting an "Authentication...
Read more >
ADAL.JS Token renewal operation failed due to timeout error
My code tries to authenticate the logged in user by getting the cached token. If the chached token is null, I use acquireToken...
Read more >
External module "error/ClientAuthError" - msal
desc: string = "AcquireToken_In_Progress: Error during login call - login is already in ... desc: string = "Token renewal operation failed due to...
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