Version 6.x has been out of support since May 14, 2024, and this corresponding section of the documentation is no longer maintained. We strongly recommend you upgrade to the latest supported version of 7.x and read the latest version of this documentation.

Login Page

The login page is responsible for establishing the user’s authentication session. This requires a user to present credentials and typically involves these steps:

  • Provide the user with a page to allow them to enter credentials locally, use an external login provider, or use some other means of authenticating.
  • Start the session by creating the authentication session cookie in your IdentityServer.
  • If the login is client initiated, redirect the user back to the client.

When IdentityServer needs to show the login page, it redirects the user to a configurable LoginUrl.

builder.Services.AddIdentityServer(opt => {
    opt.UserInteraction.LoginUrl = "/path/to/login";
})

If no LoginUrl is set, IdentityServer will infer it from the LoginPath of your Cookie Authentication Handler. For example:

builder.Services.AddAuthentication()
    .AddCookie("cookie-handler-with-custom-path", options => 
    {
        options.LoginPath = "/path/to/login/from/cookie/handler";
    })

If you are using ASP.NET Identity, configure its cookie authentication handler like this:

builder.Services
    .AddIdentityServer()
    .AddAspNetIdentity<ApplicationUser>();

builder.Services
    .ConfigureApplicationCookie(options => 
    {
        options.LoginPath = "/path/to/login/for/aspnet_identity";
    });