JWEDecryptionFailed Authentication Origin: Application & API OSI layer 7 · Application Last updated 28 Nov 2026

NextAuth: JWEDecryptionFailed: decryption operation failed

The session cookie cannot be decrypted because NEXTAUTH_SECRET changed or differs.

Exact message you may see decryption operation failed
Seen on: Next.js

Meaning

Session JWTs are encrypted with NEXTAUTH_SECRET. If the secret differs between builds or servers, or an old cookie from another secret remains, decryption fails.

Common causes

  • Secret changed
  • Different secrets
  • Old cookie
  • Secret regenerated on each deploy

⚡ Quick fix

  1. Clear cookies
  2. Use one secret
  3. Clear the site's cookies once
  4. Set a single stable NEXTAUTH_SECRET in all environments

Detailed fix by platform

Env

  1. Keep NEXTAUTH_SECRET identical everywhere

How to diagnose

  1. Secret — Same?
  2. Cookie — Cleared?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

alg none — JWT error: algorithm "none" is not allowed / Algorithm not supported (Authentication)alg noneCLIENT_FETCH_ERROR — NextAuth: [next-auth][error][CLIENT_FETCH_ERROR] Unexpected token < in JSON (Authentication)CLIENT_FETCH_ERRORGiven token not valid — {"detail":"Given token not valid for any token type","code":"token_not_valid"} (Authentication)Given token not validinvalid algorithm — JWT error: invalid algorithm / The specified alg value is not allowed / jwt signature is required (Authentication)invalid algorithminvalid_client — Sign in with Apple: invalid_client (Authentication)invalid_clientinvalid_token — invalid_token: The access token is invalid (JsonWebTokenError: invalid signature / jwt malformed) (Authentication)invalid_tokenjwt issuer invalid — JsonWebTokenError: jwt issuer invalid — iss claim mismatch (Authentication)jwt issuer invalidjwt must be provided — JsonWebTokenError: jwt must be provided (Authentication)jwt must be providedJWEDecryp…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.