Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

304
Visualizações
[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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda