Next App Router, link direct to sign up page?

Every time I set up a new auth0, and something has changed in Next, I struggle to work out how to have a “Sign up” link. Does anyone know how to do it with the new App router?

At the moment I just have the /api/auth/[auth0]/route.js file with the code below. But I’m not sure how to link to like /api/auth/register or /api/auth/signup

import { handleAuth } from '@auth0/nextjs-auth0';

export const GET = handleAuth();

Hey @SpinUp welcome back!

You should be able to achieve this with the signup handler outlined here:

Thanks! This worked a treat, I just had to tweak it for the Next 13.4 App Router, which requires a method function (GET in this case).

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

export const GET = handleAuth({
  signup: handleLogin({ authorizationParams: { screen_hint: "signup" } }),
});
1 Like

Awesome, thanks for confirming! Happy to help :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.