I am following the ASP.NET Core: Login quickstart article, link is account specific so I cannot provide it here. I am also adapting it to C# 10/.net 6.
It is using razor pages and a two MapGets to setup logging in and out.
One the razor page, the login is: Login I am specifically avoiding asp-… helpers because instead of using an AccountController, I am using two smaller minimal api calls:
app.MapGet("/login", async context => {
var returnUrl = context.Request.Query["returnUrl"] switch
{
StringValues { Count: 0 } => "/",
StringValues { Count: int n } results => results[n - 1]
};
await context.ChallengeAsync(new AuthenticationProperties() { RedirectUri = returnUrl });
});
What I expected to happen is that this /login call would redirect over to auth0, but instead it is trying to go to: https://localhost:7147/Account/Login?ReturnUrl=%2F
The link for login appears rightly as /login and that handler above is invoked. I am at my wits-end trying to figure out where this /Account/Login stuff is coming from because it isn’t specified ANYWHERE in the application. I realize the sample uses an AccountController. I am suspecting this behaviour is something built into asp.net core that my google-fu is not good enough to find.
The project I have built is at: https://github.com/idea-plex/IdeaPlexWeb/blob/main/Program.cs
It is not necessarily the case that all of the auth0 settings are configured correctly in the webapp, note that credientials won’t be found in the repo, they are stored in the secrets.
Any help is appreciated.