Gabriel Robert
Gabriel Robert

Reputation: 3080

Map IdentityServer4 to "/identity", then map UI

My application is basically this one: https://github.com/IdentityServer/IdentityServer4.Quickstart.UI

But I'm trying to map it to "/identity" using this piece of code:

app.Map("/identity", builder => { builder.UseIdentityServer(); });

It's working well, I can access /identity/.well-known/openid-configuration successfully.

However, if I try to connect, the application redirects me to /identity/account/login, which is on the IdentityServer side. IdentityServer cannot find my controller, so it returns me 404.

I tried to the LoginUrl property:

services.AddIdentityServer(options =>
{
    options.UserInteraction.LoginUrl = "/bleh/account/login";
})

But it also returns 404.

I also tried to make the Quickstart controller route the same as the redirect one:

[Route("identity/account/login")]

But it also returns 404.

Any idea?

Upvotes: 5

Views: 2194

Answers (1)

John
John

Reputation: 164

If anyone is still looking for this. This worked for me:

app.Map("/identity", builder => {
    builder.UseStaticFiles();
    builder.UseIdentityServer();
    builder.UseMvcWithDefaultRoute();
});

Upvotes: 9

Related Questions