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

JWT is null only in middleware #5083

Closed
brizzbuzz opened this issue Aug 3, 2022 · 5 comments
Closed

JWT is null only in middleware #5083

brizzbuzz opened this issue Aug 3, 2022 · 5 comments
Labels
triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@brizzbuzz
Copy link

Environment

System:
OS: macOS 12.4
CPU: (10) arm64 Apple M1 Max
Memory: 1.25 GB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.0 - ~/.volta/tools/image/node/16.14.0/bin/node
Yarn: 1.22.18 - ~/.volta/tools/image/yarn/1.22.18/bin/yarn
npm: 8.3.1 - ~/.volta/tools/image/node/16.14.0/bin/npm
Browsers:
Brave Browser: 103.1.41.100
Chrome Canary: 106.0.5216.0
Firefox: 103.0
Safari: 15.5
npmPackages:
next: 12.2.3 => 12.2.3
next-auth: ^4.10.3 => 4.10.3
react: 18.2.0 => 18.2.0

Reproduction URL

https://github.com/unredundant/next-auth-middleware-bug-repro

Describe the issue

Token is always null in middleware when using github auth :(

How to reproduce

Copy the .env.local.example and populate with github app credentials.

Start the app then sign in with github

If you go to /admin or anything that is protected by middleware, you will see that the token is null. However, go to the /api/examples/jwt page and you will see that the token is there

Screen Shot 2022-08-03 at 12 49 24 PM

Expected behavior

middleware should be able to get the existing token

@brizzbuzz brizzbuzz added the triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. label Aug 3, 2022
@dgrcode
Copy link
Contributor

dgrcode commented Aug 3, 2022

It looks like the same as #5008

It seems people (myself included) are having success by reverting NextJS to 12.2.2

@brizzbuzz
Copy link
Author

I tried that with no luck :( guess i could give it another go

@mbrameld
Copy link

mbrameld commented Aug 3, 2022

Reverting to NextJS 12.2.2 also fixed it for me.

@dgrcode
Copy link
Contributor

dgrcode commented Aug 3, 2022

I tried that with no luck :( guess i could give it another go

@unredundant I had to remove node_modules, yarn.lock/package.lock, and reinstall everything with npm.

You might be able to get things working reinstalling dependencies with yarn, but I switched to npm because it was acting up.

@brizzbuzz
Copy link
Author

ah yep @dgrcode a full wipe of node modules did the trick, gonna close in favor of the other ticket, thanks all 🙏

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

No branches or pull requests

3 participants