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.

When using @azure/msal-angula 2.0.0-alpha.3, I get this error message on ClientAuthError: state_not_found: State not found

See original GitHub issue

Library

  • msal@1.x.x or @azure/msal@1.x.x
  • @azure/msal-browser@2.x.x
  • @azure/msal-node@1.x.x
  • @azure/msal-react@1.x.x
  • @azure/msal-angular@0.x.x
  • @azure/msal-angular@1.x.x
  • @azure/msal-angular@2.x.x
  • @azure/msal-angularjs@1.x.x

Description

I’m developing an using @azure/msal-browser 2.9.0 on http://localhost using Angular, when trying to login via msal.loginRedirect() the browser reruns to the site, and correct page however the user is not logged in and the following error is in the console (from the handleRedirectObservable method) ClientAuthError: state_not_found: State not found: Cached State

Source

export function MSALInstanceFactory(): IPublicClientApplication {
  return new PublicClientApplication({
    auth: {
      clientId: 'clientId',
      authority: 'authority',
      redirectUri: 'http://localhost:4200',
      postLogoutRedirectUri: 'http://localhost:4200',
      knownAuthorities: ['knownAuthorities.b2clogin.com',
      'knownAuthorities.onmicrosoft.com'],
      navigateToLoginRequestUrl:true
    },
    cache: {
      cacheLocation: BrowserCacheLocation.LocalStorage,
      storeAuthStateInCookie: isIE, // set to true for IE 11
    },
    system: {
      loggerOptions: {
        loggerCallback,
        logLevel: LogLevel.Info,
        piiLoggingEnabled: false
      }
    }
  });
}

  this.msal.handleRedirectObservable().subscribe({
      next: (result: AuthenticationResult) => {
        console.error('result called', result);
        if (result) {
          // this.authService.instance.setActiveAccount(result.account);
          console.log(result);
        }
      },
      error: (error) => console.log(error)
    });


Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jo-arroyocommented, Feb 2, 2021

@jitendraP-ashutec The latest versions of msal-browser and msal-angular were released last night. This new version has guidance on using redirects, as well as a new inProgress$ observable that you can subscribe to, to ensure no interactions are in progress when you check for accounts. Please update using npm install @azure/msal-browser@2.11.0 @azure/msal-angular@alpha and give the new version a try. You can find documentation on inProgress$ here.

0reactions
github-actions[bot]commented, Mar 12, 2021

This issue has been closed due to inactivity. If this has not been resolved please open a new issue. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

When using @azure/Msal-browser, I get this error message on ...
This error can be caused if the handleRedirectPromise is called twice. msal-react should call this function for you, so there is no need...
Read more >
Getting error while login with Angular application in Azure AD
This error is due to when configuration has not been correctly set in your application. It seems in the app.module.ts application where you...
Read more >
ui-router: Deprecated events and hooks | Stepan Suvorov Blog
0-alpha ) you probably already noticed that there are no events that we all got used to: $stateChangeCancel, $stateChangeError, $stateChangeStart ...
Read more >
State.stateservice - UI-Router
Returns the state declaration object for any specific state, or for all registered states. Parameters. stateOrName StateOrName. : (absolute or relative) If ...
Read more >
Common Errors and Warnings | Cribl Docs
This page lists common error and warning messages that you might find in LogStream's internal logs and/or UI. It includes recommendations for resolving...
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