Search code examples
asp.net-core.net-coreopeniddict

How to reach signup page of openiddict authorization server?


I have built opeiddict as separate web application as authorization server. I am stuck with small problem, that is how I can go to user registration page directly though a link from the client web application. Right now I can go to login page, as your sample example:

public ActionResult SignIn() {
           // Instruct the OIDC client middleware to redirect the user agent to the identity provider.
           // Note: the authenticationType parameter must match the value configured in Startup.cs
           return new ChallengeResult(OpenIdConnectDefaults.AuthenticationScheme, new AuthenticationProperties {
               RedirectUri = "/"
           });
       }

Is there a way to go to authentication server Account/Register from client app?


Solution

  • It looks like you can set the url in the redirect. See the following snippet:

    [AllowAnonymous]
    public IActionResult SignIn()
    {
        return new ChallengeResult(
            OpenIdConnectDefaults.AuthenticationScheme,
            new AuthenticationProperties
            {
                IsPersistent = true,
                RedirectUri = Url.Action("SignInCallback", "Account")
            });
    }
    

    See the docs here: Initiating the authentication flow