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 のアプリケーション設定は、auth0 ログインが不平を言っているため、実際にはベースのみにAllowed Callback URLs
設定されています。http://localhost:3000/api/auth/callback/auth0
./api/auth/...[nextauth]
ファイル内の next-auth 構成は次のようになります。
...
[
NextAuthProviders.Auth0({
clientId: process.env.NEXTAUTH_AUTH0_CLIENT_ID,
clientSecret: process.env.NEXTAUTH_AUTH0_CLIENT_SECRET,
domain: process.env.NEXTAUTH_AUTH0_DOMAIN,
})
],
debug: true,
...
設定ミスの原因は何ですか? localhost で next-auth プロバイダーを介して auth0 を実行することはまったく可能ですか?