在具有通过 Auth0 授权的 next-auth 库的 NextJS 应用程序上,我在授权流程中遇到错误:
[next-auth][error][oauth_get_access_token_error] [
{
statusCode: 401,
data: '{"error":"access_denied","error_description":"Unauthorized"}'
},
undefined,
undefined
]
https://next-auth.js.org/errors#oauth_get_access_token_error
[next-auth][error][oauth_get_access_token_error] [
{
statusCode: 401,
data: '{"error":"access_denied","error_description":"Unauthorized"}'
},
undefined,
'auth0',
'HRLMyC9s88eIttwR'
]
https://next-auth.js.org/errors#oauth_get_access_token_error
[next-auth][error][callback_oauth_error] {
statusCode: 401,
data: '{"error":"access_denied","error_description":"Unauthorized"}'
}
https://next-auth.js.org/errors#callback_oauth_error
没有任何引用的错误有任何细节。
auth0 中的应用程序设置实际上只是Allowed Callback URLs
设置http://localhost:3000/api/auth/callback/auth0
为 auth0 登录抱怨它的基础。
文件中的 next-auth 配置./api/auth/...[nextauth]
如下:
...
[
NextAuthProviders.Auth0({
clientId: process.env.NEXTAUTH_AUTH0_CLIENT_ID,
clientSecret: process.env.NEXTAUTH_AUTH0_CLIENT_SECRET,
domain: process.env.NEXTAUTH_AUTH0_DOMAIN,
})
],
debug: true,
...
什么可能是错误配置?是否有可能通过本地主机上的 next-auth 提供程序运行 auth0?