Next.js Auth0 v4: successful login followed by token exchange HTTP 401 access_denied

We’re testing an isolated, nonproduction Next.js dashboard on Railway. User authentication succeeds, but the callback displays:

An error occurred while trying to exchange the authorization code.

A bounded diagnostic wrapper captured:

{"http_status":401,"oauth_error":"access_denied"}

Auth0 logs show Success Login, followed immediately by Failed Exchange (feacft) — Unauthorized. The event’s context provides no additional rejection reason.

Environment:

  • Node.js 22.23.5
  • Next.js 16.2.11
  • @auth0/nextjs-auth0 4.28.0
  • Regular Web Application using Client Secret (Post)

Checks completed:

  • Deployment client ID and domain match the intended application.
  • Owner privately compared both current and retained deployment secrets with Auth0 and reported exact matches.
  • Authorization Code grant is enabled.
  • OIDC identification is enabled and openid profile email are permitted.
  • Exact callback URLs were configured during testing.
  • No additional security-denial event appeared in the same-client, three-minute log window.

The SDK uses its default callback/session handling, without a client-authentication override. The diagnostic wrapper forwards the existing request once and returns the original response; it adds no retry.

What further read-only evidence would distinguish the cause of this specific token-endpoint rejection without rotating secrets, weakening authentication or repeatedly deploying?

The trial services are offline. No credentials, tokens, authorization codes, tenant/client/log identifiers or raw logs are included.