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

301
Views
[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
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!