Next.js auth0 - API handler that gets your straight to signup?

  • Which SDK this is regarding: @auth0/nextjs-auth0
  • SDK Version: 1.2.0

Hey - I would like to make a link that sends the user straight to the hosted auth0 signup page.

Using the New Universal Login

This is how far I’ve gotten. Created an api handler like this:

import { handleLogin } from '@auth0/nextjs-auth0';
import { NextApiRequest, NextApiResponse } from 'next';

export default async function registerHandler(
  req: NextApiRequest,
  res: NextApiResponse,
) {
  handleLogin(req, res, {
    authorizationParams: {
      mode: 'signUp', // <--- ❌ does not seem to do anything
    },
  });
}

Is there a way to send a user straight to signup?

I solved it! Found some github comment here Handle Signup · Issue #16 · auth0/nextjs-auth0 · GitHub and tried the following

import { handleLogin } from '@auth0/nextjs-auth0';
import { NextApiRequest, NextApiResponse } from 'next';

export default async function registerHandler(
  req: NextApiRequest,
  res: NextApiResponse,
) {
  handleLogin(req, res, {
    authorizationParams: {
      screen_hint: 'signup',
    },
  });
}

Is there any problem with doing the above? Is it reliable? Seems undocumented!

1 Like

Seems totally alright! Thanks for sharing it with the rest of community!

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