Open april83c opened 8 months ago
+1
Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote 👍 on the issue description or subscribe to the issue for updates. Thanks!
Environment
(I'm not using Auth.js from NPM because of #10333 and because #10340 hasn't been merged yet, but this issue reproduces on the repro project which does use Auth.js from NPM)
Reproduction URL
https://github.com/april83c/authjs-discord-without-pkce-repro
Describe the issue
When not using PKCE with the Discord provider, the authorization will go fine, but there'll be an error when it tries to get the tokens.
This is because, in the request to get the tokens, it's including a
code_verifier
(which, since we didn't use PKCE, is just"auth"
)This default
code_verifier
is there because the libraryoauth4webapi
requires you to include acode_verifier
, and they consider not using PKCE out of scope.Unfortunately, if you didn't use PKCE in the initial authorization with Discord, the Discord API will return that error (
Invalid "code_verifier"
) if you include anycode_verifier
, instead of just ignoring it and letting you get the tokens.But why don't you want to use PKCE?
To integrate with Discord's new Linked Roles feature, you have to not be using PKCE.
It would probably be fine if they just ignored the PKCE parameters, but it does sort of make sense to error (since the Discord API does usually support PKCE but doesn't in this one specific circumstance, and the developer of an app might overlook that...).
How to reproduce
Expected behavior
It should get the tokens correctly without including a
code_verifier
in the request.