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

275
Views
Siguiente Autenticación de autenticación en producción

Terminé de desarrollar mi aplicación con Next.js. Usé Next Auth para manejar la autenticación de usuario. Uso el proveedor de credenciales para la autenticación con correo electrónico y contraseña.

En desarrollo, todo funciona bien cuando inicio sesión, la sesión está bien creada y un token JWT está bien generado.

Por otro lado al poner en producción no funciona, tengo el siguiente error:

 [next-auth][error][CLIENT_FETCH_ERROR] https://next-auth.js.org/errors#client_fetch_error invalid json response body at https://my-site.fr/api/auth/csrf reason: Unexpected token < in JSON at position 0 {

Realmente no entiendo por qué el error solo aparece en producción.

Aquí está el código de mi proveedor de credenciales

 CredentialProvider({ async authorize(credentials, req) { // console.log(credentials); const url = `${process.env.NEXT_PUBLIC_API}/auth/login`; const res = await fetch(url, { method: "POST", body: JSON.stringify(credentials), headers: { "Content-Type": "application/json", Accept: "application/json, text/plain, */*'", "User-Agent": "*", }, }); // console.log(res); const user = await res.json(res); if (res.ok && user) { return user; } return null; }, }),

Gracias por tu ayuda.

about 4 years ago · Juan Pablo Isaza
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!