问题
I'm trying to use the various examples as a means to write my own, but I don't fully understand what is happening. Maybe someone can offer some insight.
I thought I needed to implement some URL that is listening for a callback from the 3rd party auth request, but when I look at the github implementation, for example, I see
public const string CallbackPath = "/signin-github";
and I don't see anything that is listening for that.
回答1:
The callback endpoint is managed by the OAuth2 generic handler:
- https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication/RemoteAuthenticationHandler.cs#L40-L55
- https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication.OAuth/OAuthHandler.cs#L45
You don't need to (and shouldn't) create your own route.
来源:https://stackoverflow.com/questions/49178819/callbackpath-implementation