【发布时间】:2021-06-30 05:44:22
【问题描述】:
我刚刚将我的新 NextJs 博客应用程序 https://blog.devdeveloper.ca/ 部署到 Vercal,但我无法让 auth0 正常工作。当点击屏幕右上角的登录按钮时,用户将被重定向到 auth0 以完成身份验证流程。
身份验证后重定向回我的应用程序时,我收到一个错误(checks.state 参数丢失),我似乎无法找到它发生的位置。
我遇到了这个article,描述了谷歌浏览器在 2020 年对 sameSite 属性进行的更新。似乎它可能与它有关,因为在我的控制台中我收到以下警告。
我想知道我的登录处理程序中是否缺少一些配置选项。
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