【问题标题】:Debugging "checks.state argument is missing" error AUTH0调试“checks.state 参数丢失”错误 AUTH0
【发布时间】:2021-06-30 05:44:22
【问题描述】:

我刚刚将我的新 NextJs 博客应用程序 https://blog.devdeveloper.ca/ 部署到 Vercal,但我无法让 auth0 正常工作。当点击屏幕右上角的登录按钮时,用户将被重定向到 auth0 以完成身份验证流程。

身份验证后重定向回我的应用程序时,我收到一个错误(checks.state 参数丢失),我似乎无法找到它发生的位置。

the error

我遇到了这个article,描述了谷歌浏览器在 2020 年对 sameSite 属性进行的更新。似乎它可能与它有关,因为在我的控制台中我收到以下警告。

sameSite attribute errors

我想知道我的登录处理程序中是否缺少一些配置选项。

import { handleAuth, handleLogin } from '@auth0/nextjs-auth0';

export default handleAuth({
    async login(req, res) {
        try {
            await handleLogin(req, res, {
                authorizationParams: {
                    audience: `http://localhost:5000/`, // or AUTH0_AUDIENCE
                    // Add the `offline_access` scope to also get a Refresh Token
                    scope: 'openid profile email create:category delete:category update:category create:post update:post delete:post create:comment delete:comment', // or AUTH0_SCOPE
                    response_type: "code"
                },

            });

        } catch (error) {
            res.status(error.status || 400).end(error.message);
        }
    }
});

也许我忽略了一些非常明显的东西。

【问题讨论】:

    标签: javascript oauth-2.0 next.js auth0


    【解决方案1】:

    经过更多调试后,我发现我的重定向 URL 不正确。我去了 Vercal 并将那个环境变量更改为正确的变量,它起作用了!令人惊讶的是,简单的错误会导致头疼。

    【讨论】:

      猜你喜欢
      • 2012-10-17
      • 1970-01-01
      • 2018-08-04
      • 2018-12-16
      • 2023-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多