【发布时间】:2022-03-24 21:50:39
【问题描述】:
我正在使用 next-auth Hazelbase 身份验证服务,但在部署时,它显示 Authorization Server policy requires PKCE to be used for this request。
注意:Hazelbase 也是一种类似于使用 google 登录的服务。
日志错误截图-
[...nextauth.js] 文件-
import NextAuth from "next-auth"
export default NextAuth({
providers: [
// hazelbase provider
{
id: 'hazelbase',
name: 'Email',
type: 'oauth',
version: '2.0',
authorizationUrl: 'https://api.hazelbase.com/oidc/auth?response_type=code',
requestTokenUrl: 'https://api.hazelbase.com/oidc/auth',
accessTokenUrl: 'https://api.hazelbase.com/oidc/token',
wellKnown: 'https://api.hazelbase.com/oidc/.well-known/openid-configuration',
profileUrl: 'https://api.hazelbase.com/oidc/me',
scope: 'openid profile name email',
protection: 'pkce',
clientId: process.env.HAZELBASE_CLIENT_ID,
params: {
grant_type: 'authorization_code',
},
profile(profile) {
return {
id: profile.sub,
...profile,
};
},
}
]
})
【问题讨论】:
-
如果您需要什么,请告诉我
-
检查对 hazel 基础服务器的请求,看看是否包含
code_challenge=CODE_CHALLENGE&code_challenge_method=S256。您使用的是最新版本的 next-auth 吗? -
@Yan 我听不懂是什么意思?
-
屏幕截图中的 GET 请求是否具有这些查询参数 ..
code_challenge和code_challenge_method
标签: javascript reactjs authentication next.js next-auth