-
Notifications
You must be signed in to change notification settings - Fork 598
Improve access_denied handling #710
Comments
Yep, though it's actually by-design: In RC2, the handler no longer returns a 500 response but directly throws an exception. If the exception is not caught by one of the middleware registered before the social provider, the server is responsible of intercepting it and returning a 500 response. To stop using the default logic (which is... well; not super user-friendly 😄), the recommended approach is to use the app.UseBattleNetAuthentication(options => {
options.SaveTokensAsClaims = true;
options.Scope.Add("wow.profile");
options.ClientSecret = Configuration["xxxxxxxxx:BattleNet:Secret"];
options.ClientId = Configuration["xxxxxxxxx:BattleNet:Key"];
options.Events = new OAuthEvents {
OnRemoteError = context => {
context.Response.Redirect("/oauth-error-page");
context.HandleResponse();
return Task.FromResult(0);
}
};
}); That said, I agree the default experience sucks. I'm pretty sure we had plans to introduce an I'll move your ticket to the aspnet/Security repository. |
Ahh OK so its returning 500 rather than throwing? Got it ;). No wonder the debug page never showed up. If rc2 does throw now then that'll help with diagnosis in the future. And wiring up that event sounds perfect. Thank you!! |
To do this properly would require a fair bit of design. We'd need a way to perhaps redirect or re-execute another page but we need a way to pass the error state to that page in order for it to do anything meaningful. For now using the event with the code above should be fine. |
A simple design might be to add a new |
@PinpointTownes give it a try and see how it works. |
@PinpointTownes your answer saved me! I was looking for an answer to this question for a week! :)) |
Closing as duplicate of #1165 |
Moved from aspnet-contrib/AspNet.Security.OAuth.Providers#81.
Not sure if this has been addressed yet:
ASP.NET Core RC1 Sample application (VS 2015 Community - not update 1)
project.json (public nuget)
"AspNet.Security.OAuth.BattleNet": "1.0.0-alpha3",
Clean user - never been to site - no identity db entries - no battle.net correlation to OAuth Application (Battlenet/identity account combo have never seen this application).
Startup ConfigureServices:
Startup Configure:
I doubt the CookieAuth is conflicting - it's a separate cookie, separate auth process that brings insecure claims down to where I can access certain info without https. No calls are made in regards to this prior to battle.net redirecting back to /signin-battlenet.
The text was updated successfully, but these errors were encountered: