【问题标题】:When using @azure/Msal-browser, I get this error message on ClientAuthError: state_not_found: State not found使用 @azure/Msal-browser 时,我在 ClientAuthError 上收到此错误消息:state_not_found: State not found
【发布时间】:2020-12-19 22:51:13
【问题描述】:

我正在使用create-react-apphttp://localhost 上开发一个使用@azure/msal-browser,当尝试通过msal.loginRedirect() 登录时,浏览器返回到该站点,并且页面正确,但是用户未登录并且控制台中出现以下错误(来自 handleRedirectPromise 方法) ClientAuthError: state_not_found: State not found: Cached State

状态参数 is 已传递到登录 url (https://login.microsoft.com...state=base64string...) 但没有任何内容本地/会话/Cookie 存储。

Azure 应用程序配置很好(以前使用过),msal 库没有工作/配置,有什么想法吗?

【问题讨论】:

  • 您使用的是哪个 MSAL 版本和代码流?

标签: typescript azure create-react-app msal


【解决方案1】:

如果两次调用handleRedirectPromise,可能会导致此错误。 msal-react 应该为您调用此函数,因此无需自己进行此调用。有关更多信息,请参阅此 github 问题:msal-browser redirect not working correctly

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-07
    • 2018-04-10
    • 1970-01-01
    • 2020-05-17
    • 2021-09-24
    • 1970-01-01
    相关资源
    最近更新 更多