MVC5 使用哪种 OAuth 2.0 身份验证流程?
Which OAuth 2.0 Authentication Flow does the MVC5 use?
我正在经历 this Example。此示例(针对 facebook)使用显式身份验证流程还是隐式身份验证流程?
查看 Katana Microsoft.Owin.Security.Facebook
命名空间中的 FacebookAuthenticationHandler.ApplyResponseChallengeAsync()
代码,它似乎总是在遇到 HTTP 401 时启动 "Authorisation Code" 流程。
string authorizationEndpoint =
"https://www.facebook.com/dialog/oauth" +
"?response_type=code" +
"&client_id=" + Uri.EscapeDataString(Options.AppId) +
"&redirect_uri=" + Uri.EscapeDataString(redirectUri) +
"&scope=" + Uri.EscapeDataString(scope) +
"&state=" + Uri.EscapeDataString(state);
这就是为什么您必须在配置中同时提供您的 clientId 和 secret 的原因。对于隐式流,您不会在任何地方使用秘密。
我正在经历 this Example。此示例(针对 facebook)使用显式身份验证流程还是隐式身份验证流程?
查看 Katana Microsoft.Owin.Security.Facebook
命名空间中的 FacebookAuthenticationHandler.ApplyResponseChallengeAsync()
代码,它似乎总是在遇到 HTTP 401 时启动 "Authorisation Code" 流程。
string authorizationEndpoint =
"https://www.facebook.com/dialog/oauth" +
"?response_type=code" +
"&client_id=" + Uri.EscapeDataString(Options.AppId) +
"&redirect_uri=" + Uri.EscapeDataString(redirectUri) +
"&scope=" + Uri.EscapeDataString(scope) +
"&state=" + Uri.EscapeDataString(state);
这就是为什么您必须在配置中同时提供您的 clientId 和 secret 的原因。对于隐式流,您不会在任何地方使用秘密。