3
votes

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
do u use react-router?Mhmdrz_A
the auth0 lock might work, i was using hte universal login page.. but i could changemichael
yes i do use react-router, my only problem is determining the URL and the "state" query string that auth0 requires.michael
Why do you want to redirect a user to sign up? Then each time a user needs to login after first sign up they will be redirected to the sign up page?Dehan

1 Answers

0
votes

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'});