When using @azure/Msal-browser, I get this error message on ClientAuthError: state_not_found: State not found

Viewed 2701

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

A state parameter is passed into the login url (https://login.microsoft.com...state=base64string...) but nothing is in the Local/Session/Cookie storage.

The Azure app config is fine (having being used before), something is not wokring/configured with the msal library, any ideas?

1 Answers

This error can be caused if the handleRedirectPromise is called twice. msal-react should call this function for you, so there is no need to do this call yourself. See this github issue for more information: msal-browser redirect not working correctly.

Related