aspnetcore2aadauth
aspnetcore2aadauth copied to clipboard
No authenticationScheme was specified
I need to had following line or get a "No authenticationScheme was specified" error on sign in.
In Startup.cs, when calling services.AddAuthentication : auth.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
PS: u deserve more gits for that code ;-)
What I've used in my apps is:
auth.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
auth.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
auth.DefaultForbidScheme = CookieAuthenticationDefaults.AuthenticationScheme;
SignInScheme is the scheme used to persist the user, so in this case, you say that you will use a cookie to store the logged-in user's claims. Maybe you haven't setup the default Challenge scheme which is what is triggered when a login is required.
P.S. Thanks :)
Also I need to update this sample with that default forbid scheme because if it isn't set, the default challenge scheme is used as fallback. And we don't usually want that here. Instead I'd rather show an access denied page via a path set in cookie auth.