How do I redirect users directly to the hosted signup page?

Question: How do I link users directly to the hosted signup page?

Answer:

The answer to this question will differ depending on how you have configured your application.

If you are using the New Universal Login Experience:

  • You can make users land directly on the Signup page instead of the Login page by specifying the screen_hint=signup parameter when redirecting to /authorize . Note that this can be combined with prompt=login , which indicates if you want to always show the authentication page or you want to skip if there’s an existing session.

If you are using Classic Universal Login, you can utilize the initialScreen option to accomplish this:

  • In the Dashboard, configure your custom login page to look for an incoming query parameter related to this operation. For example:
var isSignup = config.extraParams && config.extraParams.action === "signup";
var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
  [...] // all other Lock options
  // use the value obtained to decide the first screen
  initialScreen: isSignup ? "signUp" : "login",
  • Then, simply add action=signup as a param in your request. From the auth0-spa-js, you could add it like this:
loginWithRedirect({ action: 'signup' });

Supporting Documentation:

Documentation: Lock Configuration Options - Initial Screen, New Universal Login - Signup
Community Topic: Universal Login auth0.WebAuth.authorize go to SignUp instead of SignIn, Passing initialScreen to Lock from auth0-spa-js

Video Tutorial

8 Likes