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

302
Vistas
[NextAuth]: How to programmatically login user on the back-end?

I use several providers, including credentials provider (email & password) At some point, in the app, user can ask for 'restore password' email where he should get one-time link. After he visits the link (/api/users/quick_link?token=XXX&email) I check if the token is valid and after that my goal is to login user and to redirect him to his profile page.

What have I tried:

  1. Using 'nextauth/client' signIn function, which obviously does not work on back-end
  2. Checking how they do 'email' provider - the starting part is more or less the same, but it quickly start using internal functions, which I do not plan (at least now) to touch.

What I have not tried: Using REST API.

Because I am not sure how to use it from another api. Just await fetch?

Recap

Short version: after visiting /api/users/login_me_asap?myemail=xxx I want to login user and redirect him.

over 4 years ago · Santiago Trujillo
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