Redirecting to another page other than "/" using nextjs-auth0

If you’re looking to send all signed in users to the same path, here’s the code I am using

import { handleAuth, handleLogin } from "@auth0/nextjs-auth0";

export default handleAuth({
  async login(req, res) {
    await handleLogin(req, res, {
      returnTo: "/##DESIREDPATH##",
    });
  },
});

I do know you can use some neat stuff with the returnTo configurations, I’d check out the SDK directly for more specific exmaples
https://github.com/auth0/nextjs-auth0

5 Likes