[next-auth][error][JWT_SESSION_ERROR] "\nhttps://next-auth.js.org/errors#jwt_session_error" "decryption operation failed" {} #12865
Replies: 1 comment
-
Why This Happens: The session stored in one application (admin) is signed with NEXTAUTH_SECRET for the admin project, and when you visit the customer project, which uses a different NEXTAUTH_SECRET, NextAuth cannot decrypt the JWT because the secret used to sign it doesn't match the secret used to verify it. Try using the same NEXTAUTH_SECRET. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am running 2 next js projects concurrently... one for admin and one for customer... I implemented next-auth in both projects, and I am using 2 different NEXTAUTH_SECRET for both projects.. now if i login to admin and visit customer project, I will have error.
Error: [next-auth][error][JWT_SESSION_ERROR] "\nhttps://next-auth.js.org/errors#jwt_session_error" "decryption operation failed" {}
Reason of error: This can also occur if you have changed the NEXTAUTH_SECRET, but you still had an active session with the old secret. Logging in again solves the issue.
In my case, how to solve my problem ? I tried changing cookies keys for both project, but it is not helping...
Customer auth.ts: https://gist.github.com/abdulazizkhatamov/8558247209c22382f5cf0cf658053ac8
Admin auth.ts: https://gist.github.com/abdulazizkhatamov/992e8a5558373e7b12f44e5f98668dd9
Error screenshot:

Beta Was this translation helpful? Give feedback.
All reactions