I am implementing Auth0 for Asp.Net mvc project. I want the users to go to signup page directly upon clicking on the signup link. I see the documentation says
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.
This is what I have in the code, how do I make sure to pass that as parameters:
HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties
{
RedirectUri = returnUrl ?? Url.Action("Login", "Account"),
},
"Auth0");
This resolved the issue:
var authProperties = new AuthenticationProperties();
**authProperties.Dictionary.Add("screen_hint", "signup");**
authProperties.RedirectUri = Url.Action("Login", "Account");
HttpContext.GetOwinContext().Authentication.Challenge(authProperties, "Auth0");
Now in the startup, we need to fetch the parameter supplied:
RedirectToIdentityProvider = notification =>
{
if (notification.ProtocolMessage.RequestType == OpenIdConnectRequestType.Authentication)
{
// The context's ProtocolMessage can be used to pass along additional query parameters
// to Auth0's /authorize endpoint.
var paramsDictionary = notification.OwinContext.Request.Context.Authentication
.AuthenticationResponseChallenge?.Properties.Dictionary;
**if (paramsDictionary != null && paramsDictionary.ContainsKey("screen_hint"))
{
notification.ProtocolMessage.SetParameter("screen_hint",
paramsDictionary["screen_hint"]);
}**
}