PKCE used when not wanted

I'm having this issue with authjs v5 using the Discord provider where even when I set the checks to not have PKCE, it has this error:
web:dev: [auth][error] CallbackRouteError: Read more at https://errors.authjs.dev#callbackrouteerror
web:dev: [auth][cause]: Error: TODO: Handle www-authenticate challenges as needed
web:dev: at handleOAuth (webpack-internal:///(rsc)/../../node_modules/next-auth/node_modules/@auth/core/lib/actions/callback/oauth/callback.js:71:15)
web:dev: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
web:dev: at async Module.callback (webpack-internal:///(rsc)/../../node_modules/next-auth/node_modules/@auth/core/lib/actions/callback/index.js:33:41)
web:dev: at async AuthInternal (webpack-internal:///(rsc)/../../node_modules/next-auth/node_modules/@auth/core/lib/index.js:42:24)
web:dev: at async Auth (webpack-internal:///(rsc)/../../node_modules/next-auth/node_modules/@auth/core/index.js:123:29)
web:dev: at async eval (webpack-internal:///(rsc)/../../node_modules/next/dist/esm/server/future/route-modules/app-route/module.js:218:37)
web:dev: [auth][details]: {
web:dev: "provider": "discord"
web:dev: }
web:dev: ⨯ Error [TypeError]: immutable
web:dev: at _Headers.delete (file:///Users/shadow/Coding/buape/kiai/node_modules/next/dist/compiled/edge-runtime/index.js:1:657096)
web:dev: at runWithTaggedErrors (file:///Users/shadow/Coding/buape/kiai/node_modules/next/dist/server/web/sandbox/sandbox.js:106:43)
web:dev: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
web:dev: at async DevServer.runEdgeFunction (file:///Users/shadow/Coding/buape/kiai/node_modules/next/dist/server/next-server.js:1173:24)
web:dev: at async NextNodeServer.handleCatchallRenderRequest (file:///Users/shadow/Coding/buape/kiai/node_modules/next/dist/server/next-server.js:242:37)
web:dev: at async DevServer.handleRequestImpl (file:///Users/shadow/Coding/buape/kiai/node_modules/next/dist/server/base-server.js:805:17)
web:dev: [auth][error] CallbackRouteError: Read more at https://errors.authjs.dev#callbackrouteerror
web:dev: [auth][cause]: Error: TODO: Handle www-authenticate challenges as needed
web:dev: at handleOAuth (webpack-internal:///(rsc)/../../node_modules/next-auth/node_modules/@auth/core/lib/actions/callback/oauth/callback.js:71:15)
web:dev: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
web:dev: at async Module.callback (webpack-internal:///(rsc)/../../node_modules/next-auth/node_modules/@auth/core/lib/actions/callback/index.js:33:41)
web:dev: at async AuthInternal (webpack-internal:///(rsc)/../../node_modules/next-auth/node_modules/@auth/core/lib/index.js:42:24)
web:dev: at async Auth (webpack-internal:///(rsc)/../../node_modules/next-auth/node_modules/@auth/core/index.js:123:29)
web:dev: at async eval (webpack-internal:///(rsc)/../../node_modules/next/dist/esm/server/future/route-modules/app-route/module.js:218:37)
web:dev: [auth][details]: {
web:dev: "provider": "discord"
web:dev: }
web:dev: ⨯ Error [TypeError]: immutable
web:dev: at _Headers.delete (file:///Users/shadow/Coding/buape/kiai/node_modules/next/dist/compiled/edge-runtime/index.js:1:657096)
web:dev: at runWithTaggedErrors (file:///Users/shadow/Coding/buape/kiai/node_modules/next/dist/server/web/sandbox/sandbox.js:106:43)
web:dev: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
web:dev: at async DevServer.runEdgeFunction (file:///Users/shadow/Coding/buape/kiai/node_modules/next/dist/server/next-server.js:1173:24)
web:dev: at async NextNodeServer.handleCatchallRenderRequest (file:///Users/shadow/Coding/buape/kiai/node_modules/next/dist/server/next-server.js:242:37)
web:dev: at async DevServer.handleRequestImpl (file:///Users/shadow/Coding/buape/kiai/node_modules/next/dist/server/base-server.js:805:17)
Not sure where to go from here tbh other than filing a bug report, i specifically have the provider set to use "state" not "pkce"
Solution:
For those of you looking at this in the future, I said "Screw this" and left nextauth for good, using lucia or clerk for my projects now. Hopefully you can find the solution you're needing elsewhere o7
Jump to solution
1 Reply
Solution
Shadow
Shadow11mo ago
For those of you looking at this in the future, I said "Screw this" and left nextauth for good, using lucia or clerk for my projects now. Hopefully you can find the solution you're needing elsewhere o7
Want results from more Discord servers?
Add your server