nextauthjs / nextauthjs/next-auth

OperationProcessingError: unexpected ID Token "nonce" claim value for SlackProvider

Open
#9,002 4 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug providers triage
Dominant language
TypeScript
Stars
28.4k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

Provider type

Slack

Environment

System:

  • OS: macOS 14.1
  • CPU: Apple M1

Binaries:

  • Node: 20.8.1
  • npm: 10.2.0

Browsers:

  • Firefox: 120.0b2

npmPackages:

  • next: 14.0.0 => 14.0.0
  • next-auth: ^5.0.0-beta.3 => 5.0.0-beta.3
  • react: 18.2.0 => 18.2.0
Reproduction URL

https://github.com/Starefossen/next-auth-example

import NextAuth from "next-auth"
import SlackProvider from "next-auth/providers/slack"

import type { NextAuthConfig } from "next-auth"

export const config = {
  theme: {
    logo: "https://next-auth.js.org/img/logo/logo-sm.png",
  },
  debug: true,
  providers: [
    SlackProvider({
      clientId: process.env.SLACK_CLIENT_ID!,
      clientSecret: process.env.SLACK_CLIENT_SECRET!,
    }),
  ],
  callbacks: {
    authorized({ request, auth }) {
      const { pathname } = request.nextUrl
      return pathname === "/middleware-example" && !!auth
    },
  },
} satisfies NextAuthConfig

export const { handlers, auth, signIn, signOut } = NextAuth(config)
Describe the issue

With standard config for Slack Provider auth. After authenticating with Slack the return request fails with the following error: unexpected ID Token "nonce" claim value

[auth][error][CallbackRouteError]: Read more at https://errors.authjs.dev#callbackrouteerror
[auth][cause]: OperationProcessingError: unexpected ID Token "nonce" claim value
    at Module.processAuthorizationCodeOpenIDResponse (webpack-internal:///(rsc)/./node_modules/oauth4webapi/build/index.js:1091:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async handleOAuth (webpack-internal:///(rsc)/./node_modules/@auth/core/lib/oauth/callback.js:77:24)
    at async Module.callback (webpack-internal:///(rsc)/./node_modules/@auth/core/lib/routes/callback.js:34:41)
    at async AuthInternal (webpack-internal:///(rsc)/./node_modules/@auth/core/lib/index.js:104:38)
    at async Auth (webpack-internal:///(rsc)/./node_modules/@auth/core/index.js:121:30)
    at async /Users/hans/go/src/github.com/nextauthjs/next-auth-example/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:61856
[auth][details]: {
  "provider": "slack"
}
How to reproduce
  • npm run dev
  • browse to /api/auth/signin
  • click login with slack
Expected behavior

Expected the user to be logged in successfully.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Slack sign-in flow in the linked next-auth-example using the shown provider configuration, then inspect the callback path where oauth4webapi processes the authorization-code response. Confirm how Slack's nonce claim is handled and verify that browsing to /api/auth/signin and completing Slack login ends with a successful session.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, node.js, react, typescript
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.