I'm trying to setup Microsoft Account Authentication in an ASP.net core application.
I pretty much followed ben day's post expect I couldn't get to the end.
Once the user is redirect to the step where it should enter the email address, I'm instead redirected to an access denied page (from my asp.net application).
In the console I can see the following error messsages:
Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationMiddleware:Information: AuthenticationScheme: Identity.External signed in. Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 1260.8977ms 302 Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request starting HTTP/1.1 GET http://localhost:44394/
Microsoft.AspNetCore.Authorization.DefaultAuthorizationService:Information: Authorization failed for user: . Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker:Warning: Authorization failed for the request at filter 'Microsoft.AspNetCore.Mvc.Authorization.AuthorizeFilter'. Microsoft.AspNetCore.Mvc.ChallengeResult:Information: Executing ChallengeResult with authentication schemes (). Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationMiddleware:Information: AuthenticationScheme: Identity.External was successfully authenticated. Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationMiddleware:Information: AuthenticationScheme: Identity.External was forbidden. Microsoft.AspNetCore.Authentication.MicrosoftAccount.MicrosoftAccountMiddleware:Information: AuthenticationScheme: Microsoft was forbidden.
Here is my current configuration (very simple)
app.UseIdentity(); app.UseMicrosoftAccountAuthentication(new MicrosoftAccountOptions { DisplayName = "Microsoft Account", ClientId = "my id", ClientSecret = "my secret", AutomaticChallenge = true });
Any idea why I get an access denied?