Blazor WASM Redirect UserTo Signup on Universal Login

With .NET Blazor WASM, sending a user to Universal Login is as easy as

<a href="authentication/login">Log In</a>

How do I send them directly to the Signup Tab? In React I used screen_hint but I can’t find that here

Hi @nexusrob

Welcome to the Auth0 Community :grinning:

In a nutshell, to send the user to the sign up prompt directly, you would need to add screen_hint as an additional parameter to the /authorize request.

Looking at the OidcProviderOptions there is support for AdditionalProviderParameters which we can use to add a screen_hint parameter as below:

builder.Services.AddOidcAuthentication(options =>
{
  builder.Configuration.Bind("Auth0", options.ProviderOptions);
  options.ProviderOptions.ResponseType = "code";
  options.ProviderOptions.AdditionalProviderParameters.Add("screen_hint", "signup");
});

Hopefully this helps you.

Warm regards.

Thanks Saqib - that works great to make all buttons go to signup, but now my login buttons go there too. Do you know how I can have both login and signup buttons in my app?

Hi @nexusrob

Alternatively, another option maybe to remove the AdditionalProviderParameter and if you have a RemoteAuthenticatorView configured, add a Registering property to build the required signup link like this:

<Registering>
    @{
        var authority = (string)Configuration["Auth0:Authority"];
        var clientId = (string)Configuration["Auth0:ClientId"];

        Navigation.NavigateTo($"{authority}/authorize?client_id={clientId}&response_type=code&screen_hint=signup");
     }
</Registering>

Then your signup button can link to it via <a href="authentication/register">Sign Up</a>

Warm regards.

2 Likes

Worked perfectly. thanks

1 Like