MVC5使用哪种OAuth 2.0身份验证流程?

时间:2016-03-03 10:11:14

标签: asp.net-mvc oauth-2.0 owin facebook-c#-sdk facebook-oauth

我正在经历this Example。此示例(对于Facebook)是否使用显式身份验证流程或隐式身份验证流程?

1 个答案:

答案 0 :(得分:1)

查看Katana FacebookAuthenticationHandler.ApplyResponseChallengeAsync()命名空间中的Microsoft.Owin.Security.Facebook代码,看起来总是启动"授权代码"遇到HTTP 401时流动。

        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的原因。对于隐式流,你不会在任何地方使用秘密。