0

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-

enter image description here

[...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,
                };
            },
        }

    ]
})
juliomalves
  • 42,130
  • 20
  • 150
  • 146
Gulshan Aggarwal
  • 954
  • 1
  • 7
  • 13

1 Answers1

-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.

Chino Chang
  • 178
  • 6