Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

451
Views
¿Cómo definir un secreto JWT en next-auth para evitar errores en prod?

¿Cómo definir un secreto JWT en NextAuth.js v4 para evitar errores en la producción? Seguí las instrucciones como decían en la documentación: https://next-auth.js.org/configuration/options#secret .

Y sigo recibiendo esta advertencia (este enlace no explica ningún detalle):

[siguiente-autorización][aviso][NO_SECRET]

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

Mi [...nextauth].js se ve así:

 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 fue generado por openssl rand -base64 32 .

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

El secret debe establecerse en el nivel superior en el objeto de configuración next-auth (mismo nivel que providers , session y jwt ), en lugar de estar anidado dentro de 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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!