n9p4
n9p4

Reputation: 277

Nextauth requires a SECRET property

After checking the documentation it says that .env or [..nextAuth.js] file you should set a secret property in the configuration.

Error documentation to nextAuth

.env

NEXTAUTH_URL = "http://localhost:3000"
NEXTAUTH_SECRET_KEY="test"

[...nextAuth.js]

  secret: "test",
  jwt: {
    secret: "test",
    encryption: true,
    maxAge: 5 * 60,
  },
  pages: {
    signIn: "/auth/login",
  },

However, this is a requirement only if you are in production, but I am not. How to fix this error and set it on development, not in production?

Upvotes: 1

Views: 7713

Answers (1)

ndom91
ndom91

Reputation: 837

Yeah the new environment variable is called simply NEXTAUTH_SECRET.

Also when this is set, you can avoid setting the secret and jwt.secret values separately in the configuration.

Upvotes: 4

Related Questions