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.
Looks like they've changed it again (as of 07/05/2023). To navigate directly to the Sign Up portion of the login you need to use the authorizationParams.
loginWithRedirect({
authorizationParams: {
'screen_hint': 'signup',
}});
Credits to this article.
The two prior answers refer to v1 and v2 of our SDKs respectively. We introduced new parameters as authorizationParams in v2 in 2022 in order to structure these better and allow room for improvements like your own custom parameters. This breaking change is documented in our version migration guide.
Expanding a bit on the other answers, from the v2 docs:
await client.loginWithRedirect({
appState: {
key: value // state to restore when getting redirected back
},
authorizationParams: {
screen_hint: 'signup',
any_custom_property: 'value'
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With