'Authorization Server policy requires PKCE to be used for this request
I'm using next-auth Hazelbase authentication service but when I'm deploying, it says Authorization Server policy requires PKCE to be used for this request.
Note: Hazelbase is also a service like sign in with google.
Logs Error Screenshot-
[...nextauth.js] file-
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,
};
},
}
]
})
Solution 1:[1]
UPDATE: Without diagnostic details, we cannot help you. please check your NextAuth.js version and the URL of Hazelbase authorization page.
PKCE support for NextAuth.js was add on v3.2.0, please consider check your package versions and re-try with newer version.
To check if PKCE was configured successfully, check the URL of Hazelbase authorization page if code_challenge present.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

