简体   繁体   English

Laravel 8 和 Auth0 插件 6.2 的 Auth0“无效状态”异常

[英]Auth0 “Invalid state” exception with Laravel 8 and Auth0 plugin 6.2

Recently upgraded our stack to use PHP 8 and Laravel 8.22 This required an upgrade within composer of the Auth0 library:最近升级了我们的堆栈以使用 PHP 8 和 Laravel 8.22 这需要在 Auth0 库的作曲家中进行升级:

"auth0/login" from "5.4" to "6.2" “auth0/login”从“5.4”到“6.2”

The code snippet that creates the error is this:创建错误的代码片段是这样的:

    /** @var Auth0Service $service */
    $service = App::make('auth0');
    $profile = $service->getUser();

When trying to get the user, the app fails with尝试获取用户时,应用程序失败

Auth0\SDK\Exception\CoreException
Invalid state 

The Auth0 logs online show a successfull login Auth0 在线日志显示登录成功

At this point I have no idea how to debug this… where should I start.在这一点上,我不知道如何调试这个……我应该从哪里开始。 Remember this was a perfectly fine working application before the version upgrade.请记住,在版本升级之前,这是一个运行良好的应用程序。

In the original question, the reason why I needed the user information was to be able to manually create a loginUrl for Auth0.在最初的问题中,我需要用户信息的原因是能够手动为 Auth0 创建 loginUrl。

This ended up working fine with the following code最终使用以下代码可以正常工作

    $loginUrl = (new Auth0([
        'audience' => 'http://my-own-audience.test/',
    ]))->getLoginUrl();

Because we were extending some of the Auth0 functionality we had an issue of not creating the proper information with our extended classes for the login url.因为我们正在扩展一些 Auth0 功能,所以我们遇到了一个问题,即没有使用我们的扩展类为登录 url 创建正确的信息。 So instead of fixing our classes we just ended up using more of the Auth0 code which works fine.因此,我们最终没有修复我们的类,而是使用了更多可以正常工作的 Auth0 代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM