Auth0 and react, redirect user to signup page

Viewed 798

I am using Auth0 for my authentication on a React + C# asp.net core page.

I would like the users to click "Sign up" and it direct them to the Auth0 Universal Sign up page. I'm able to direct users to the Login Page with this code:

await loginWithRedirect({
    appState: { targetUrl: location.pathname || window.location.pathname },
});

Using the example react-auth0-spa.js and @auth0/auth0-spa-js library.

However, I can't see any examples online on how to direct a user directly to the sign up (not login) page.

1 Answers

I know this is a very old question but I just had the exact same problem myself using the auth0-spa-js client so hopefully someone else will stumble on this answer and find it useful.

The solution was to pass the screen_hint param to the loginWithRedirect method like this:

loginWithRedirect({screen_hint: 'signup'});
Related