-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error The code_verifier cookie was not found when trying to use with PKCE #1367
Comments
Could you please provide a reproduction/some code? Also what browser/device do you use? We have seen similar problems on iOS devices/Safari You could try debugging as well, see if it gives you more useful info. |
a full reproduction i cannot post, but i use a Mac with Chrome, and use Azure B2C with the option "protection" set to 'pkce', then comes the error. Using "protection" set to "state" also not works, i got error that the State value is invalid. So i have to set "protection" to "none". |
i was trying to use it with Azure B2C (not Azure AD) , and with "protection" set to 'pkce' i got that error. I don't know from where it comes. When i check the browser cookie, i see the code_verifier cookie is there, but i still got the error |
could you confirm if the problem persists on a non-Apple device? |
i don't have any windows machine so i can't really test it. But you think this is related to Apple devices? |
@balazsorban44 it seems to be the same problem that I'm facing with Okta, setting the When using the
|
I'm getting the exact same issue, authenticating to Azure B2C using "pkce": "OAuthCallbackError: The code_verifier cookie was not found." |
The same for me. It looks like the https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/oauth/pkce-handler.js#L23 |
@wjkawecki make sure you enable PKCE in the IDS client as well. We use it at work as well, and PKCE works just fine. |
So I think I made some progress on this. Could someone of you how is hitting this problem check if the suggested cookie changes have any effect? @vtrphan @goldfishgam3r? Also, could someone verify if they use |
@balazsorban44 Im using that response mode and cookies are empty |
have you seen the linked issue? I was told it worked for them |
Sorry what i meant to say
yes that fixed it :) |
super! since we are using cookies, for now, I don't think we have a better solution, but since third party cookies seem to go away in a few years in the future, we might have to find something else. but for now I'm closing this. |
Here's what fixed it for me:
|
Describe the bug
I got an error : The code_verifier cookie was not found when trying to use NextAuth with protection option set to 'pkce' and identity provider is Azure B2C. I check the cookie but it was there under the name next-auth.pkce.code_verifier. Why does it say code_verifier_cookie not found ?
Steps to reproduce
Steps to reproduce the behavior.
Include a link to public repository which can be used to reproduce the behaviour.
Expected behavior
No error happens
Screenshots or error logs
If applicable add screenshots or error logs to help explain the problem.
Additional context
Add any other context about the problem here.
Feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.
The text was updated successfully, but these errors were encountered: