unexpected ID Token "nonce" claim value
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- nodejs, typescript
- Domain
- authentication
Research direction
Start with @auth/core/lib/oauth/callback.js and the processAuthorizationCodeOpenIDResponse call shown in the stack trace, then compare the working @auth/core@0.5.1 patch with the @auth/core@0.6.0 behavior. Reproduce with the linked SvelteKit Cognito sample using PKCE and nonce checks; done means the callback accepts the expected nonce without the OperationProcessingError.
Written by the indexing model from the issue text.
Description
Provider type
Cognito
Environment
System:
OS: macOS 13.3.1
CPU: (10) arm64 Apple M1 Max
Memory: 153.55 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 19.9.0 - /opt/homebrew/bin/node
npm: 9.6.3 - /opt/homebrew/bin/npm
Browsers:
Chrome: 112.0.5615.121
Firefox: 101.0
Safari: 16.4
Reproduction URL
https://github.com/half2me/sveltekit-authjs-houdini
Describe the issue
I'm using SvelteKit with Auth.js using the Cognito provider with pcke and nonce checks.
Cognito({
...
checks: ['pkce', 'nonce']
})
After logging in, when being redirected to the my site, I get this error:
[auth][error][CallbackRouteError]: Read more at https://errors.authjs.dev#callbackrouteerror
[auth][cause]: OperationProcessingError: unexpected ID Token "nonce" claim value
at Module.processAuthorizationCodeOpenIDResponse (file:///Users/halftome/sveltekit-authjs-houdini/node_modules/oauth4webapi/build/index.js:1038:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async handleOAuth (file:///Users/halftome/sveltekit-authjs-houdini/node_modules/@auth/sveltekit/node_modules/@auth/core/lib/oauth/callback.js:79:24)
at async Module.callback (file:///Users/halftome/sveltekit-authjs-houdini/node_modules/@auth/sveltekit/node_modules/@auth/core/lib/routes/callback.js:14:41)
at async AuthInternal (file:///Users/halftome/sveltekit-authjs-houdini/node_modules/@auth/sveltekit/node_modules/@auth/core/lib/index.js:64:38)
at async Proxy.Auth (file:///Users/halftome/sveltekit-authjs-houdini/node_modules/@auth/sveltekit/node_modules/@auth/core/index.js:100:30)
at async Module.respond (/node_modules/@sveltejs/kit/src/runtime/server/respond.js:257:20)
at async file:///Users/halftome/sveltekit-authjs-houdini/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:513:22
[auth][details]: {
"provider": "cognito"
}
How to reproduce
I have a sample repo attached showing the issue. I've just updated to @auth/core@0.6.0.
Previously I had this issue fixed by using @auth/core@0.5.1, and applying this patch:
--- node_modules/@auth/core/lib/oauth/callback.js 2023-03-28 16:30:20
+++ node_modules/@auth/core/lib/oauth/callback.js 2023-04-17 14:11:07
@@ -76,7 +76,8 @@
let profile = {};
let tokens;
if (provider.type === "oidc") {
- const result = await o.processAuthorizationCodeOpenIDResponse(as, client, codeGrantResponse);
+ const result = await o.processAuthorizationCodeOpenIDResponse(as, client, codeGrantResponse, nonce?.value ??
+o.expectNoNonce);
if (o.isOAuth2Error(result)) {
console.log("error", result);
throw new Error("TODO: Handle OIDC response body error");
You can see the working version at this commit: https://github.com/half2me/sveltekit-authjs-houdini/tree/a3f19a03c79e8b2e20a06c6acacb240ac434d8c3
After updating to the new version, I'm getting the same error I used to have before.
Expected behavior
nonce value was specified as a check, so I'd expect it to work.
- Dominant language
- TypeScript
- Stars
- 28.4k
- Forks
- 4k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nextauthjs/next-auth
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
nextauthjs/next-auth#13495 ·
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 88/100
nextauthjs/next-auth#13483 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
nextauthjs/next-auth#13475 ·
-
triage
Difficulty 1/5 Under an hour Newbie friendliness 88/100
nextauthjs/next-auth#13472 ·
-
bug triage
Difficulty 1/5 Under an hour Newbie friendliness 68/100
nextauthjs/next-auth#13204 ·
All issues in nextauthjs/next-auth
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·