NextAuth v4 - JWT_SESSION_ERROR

Viewed 2783

This is the error :

[next-auth][error][JWT_SESSION_ERROR] 
https://next-auth.js.org/errors#jwt_session_error 
Invalid Compact JWE {  
message: 'Invalid Compact JWE',   
stack: 'JWEInvalid: Invalid Compact JWE

I met this error while migrating to v4. I saw this in the documentation :

If you are unable to use an HS512 key (for example to interoperate with other services) you can define what is supported using

  jwt: {
    signingKey: {"kty":"oct","kid":"--","alg":"HS256","k":"--"},
    verificationOptions: {
      algorithms: ["HS256"]
    }
  }

But I don't get in which file I should put it. In which file this should go ?

1 Answers

The file is api/auth/[...nextauth].js

You have to pass it into the NextAuth function. I found it here.

Related