Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

454
Vistas
How to define a JWT secret in next-auth to avoid errors in prod?

How to define a JWT secret in NextAuth.js v4 to avoid errors in prod? I followed the instructions as they said in the documentation: https://next-auth.js.org/configuration/options#secret.

And I still getting this warning (this link doesn't explain any details about):

[next-auth][warn][NO_SECRET]

https://next-auth.js.org/warnings#no_secret

My [...nextauth].js looks like:

export default NextAuth({
  providers: [
    GoogleProvider({
      clientId: process.env.GOOGLE_CLIENT_ID,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET
    })
  ],
  session: {
    strategy: "jwt",
    maxAge: 30 * 24 * 60 * 60, // 30 days
    updateAge: 24 * 60 * 60, // 24 hours
  },
  jwt: {
    secret: process.env.JWT_SECRET,
    maxAge: 60 * 60 * 24 * 30,
    async encode({ secret, token, maxAge }) {},
    async decode({ secret, token }) {},
  },
})

JWT_SECRET was generated by openssl rand -base64 32.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The secret has to be set at the top-level on the next-auth config object (same level as providers, session and jwt), instead of nested inside jwt.

export default NextAuth({
    providers: [
        GoogleProvider({
            clientId: process.env.GOOGLE_CLIENT_ID,
            clientSecret: process.env.GOOGLE_CLIENT_SECRET
        })
    ],
    session: { /*...*/ },
    jwt: { /*...*/ },
    secret: process.env.JWT_SECRET
})
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda