Skip to content
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

State cookie / PKCE code_verifier cookie missing #12833

Open
LoickNosal opened this issue Apr 2, 2025 · 2 comments
Open

State cookie / PKCE code_verifier cookie missing #12833

LoickNosal opened this issue Apr 2, 2025 · 2 comments
Labels
bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@LoickNosal
Copy link

Environment

  System:
    OS: macOS 15.3.2
    CPU: (8) arm64 Apple M3
    Memory: 109.34 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
  Browsers:
    Chrome: 134.0.6998.166
    Safari: 18.3.1
  npmPackages:
    @auth/mongodb-adapter: ^3.7.4 => 3.8.0 
    next: ^14.2.20 => 14.2.25 
    next-auth: ^4.24.11 => 4.24.11 
    react: 18.2.0 => 18.2.0 

Reproduction URL

https://github.com/LoickNosal/Cookie-Missing-NextAuth

Describe the issue

Hello, I'm having a problem with NextAuth.

I use two providers: Google and Apple.
I have one problem for each provider:

  • For Google:

[next-auth][error][OAUTH_CALLBACK_ERROR]
State cookie was missing
providerId: 'google',
message: 'State cookie was missing.'

  • For Apple:

[next-auth][error][OAUTH_CALLBACK_ERROR]
PKCE code_verifier cookie was missing.
providerId: 'apple',
message: 'PKCE code_verifier cookie was missing.'

These messages appear each time I log in to my application. It's not blocking, and users are able to log in. I'd like to understand the cause because I've already added a PKCE cookie to my next-auth.ts file.
This is polluting my environment's logs, and I'd like to fix it as soon as possible.

My next-auth.ts and next-auth.d.ts files in the link
Here are the versions used:
"next": "^14.2.20",
"next-auth": "^4.24.11",
"react": "18.2.0",


### How to reproduce

https://github.com/LoickNosal/Cookie-Missing-NextAuth

### Expected behavior

Shouldn't pollute my console with missing cookies errors.
@LoickNosal LoickNosal added bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels Apr 2, 2025
@debarkamondal
Copy link

I also faced this using the Github Provider. I somehow fixed it. I deleted parts and started adding parts back in until the issue started to appear. It was caused due to parsing problem. I sent some mismatched data. I just had to handle that and its working again.

I would recommend you do the same while keeping this in mind. Best of luck and let me know if it helped.

@LoickNosal
Copy link
Author

Hello, thank you for your reply. Could I have more details on your parsing error?
I've run several tests, but I'm still having the same problem in production (and I can't reproduce it in a dev environment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

2 participants