Using Private Key JWT method with NextJS

I am currently using the “Private key JWT” Auth method and I’m running into this error when the callback is hit:

] CallbackHandlerError: Callback handler failed. CAUSE: access_denied (Unauthorized)
[0]     at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/callback.js:62:19)
[0]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[0]     at async eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:60:24)
[0]     at async /Users/judeagboola/Downloads/sample-01/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:1:66877 {
[0]   code: 'ERR_CALLBACK_HANDLER_FAILURE',
[0]   cause: IdentityProviderError: access_denied (Unauthorized)

I’m using this auth method because the software I want to authenticate users into has some authentication system that I can’t change. It needs a JWT that was signed using a private key that both the software and auth0 know about.

I am using the Nextjs sample while using the following environment variables

AUTH0_SECRET='A long secret value used to encrypt the session cookie. You can generate a suitable string'
AUTH0_BASE_URL='App base URL'
AUTH0_ISSUER_BASE_URL='The URL of your Auth0 tenant domain'
AUTH0_CLIENT_ID='Client ID'
AUTH0_CLIENT_SECRET='Your Auth0 application's Client ID.'

Do I need to pass the public key from my generated pair into an ENV?
Is there any special setup I need to do to get this working?

Hi @marvinjudehk,

Welcome to the Auth0 Community!

Are you seeing anything in the error description? Or your Auth0 Dashboard logs?