1

I am using auth0 as login feature. After login the user is sent here:

export default async function callback(req, res) {
  try {
    await auth0.handleCallback(req, res, {
      onUserLoaded: async (req, res, session, state) => {
        //make here redirect on 2 different pages depending by session
      }
    });
  } catch (error) {
    console.error(error);
    res.status(error.status || 400).end(error.message);
  }
}

I want to do a redirect depending by the session, but i can't figure out how.
Question: How to do a redirect and to achieve what i described? ex:

if (session === something) {
  res.redirect('first-page')
} else {
  res.redirect('second-page')
}
Asking
  • 3,487
  • 11
  • 51
  • 106
  • Does this answer your question? [Next.js Redirect from / to another page](https://stackoverflow.com/questions/58173809/next-js-redirect-from-to-another-page) – mehowthe Mar 01 '21 at 09:27
  • @mehowthe, no, do you know how to make he redirect on 2 different pages using `callback` function? – Asking Mar 01 '21 at 09:49

0 Answers0