Oauth 2.0 WebApi2 Google OAuth2中间件错误响应

Oauth 2.0 WebApi2 Google OAuth2中间件错误响应,oauth-2.0,asp.net-web-api2,google-signin,Oauth 2.0,Asp.net Web Api2,Google Signin,对于外部提供商(如谷歌)的用户身份验证,它使用特定的Owin中间件。例如Microsoft.Owin.Security.Google。WebAPI2模板使用它来支持隐式流身份验证(response_type=token)。但是代码流呢 是否可以实现代码流(响应类型=代码) 调试完这些OAuth提供程序后,我注意到将return_type=code传递给Google,它成功地验证并返回带有访问和刷新令牌的json,然后用户通过api/Account/ExternalLogin端点登录,但在流的末尾

对于外部提供商(如谷歌)的用户身份验证,它使用特定的Owin中间件。例如Microsoft.Owin.Security.Google。WebAPI2模板使用它来支持隐式流身份验证(response_type=token)。但是代码流呢

是否可以实现代码流(响应类型=代码)

调试完这些OAuth提供程序后,我注意到将return_type=code传递给Google,它成功地验证并返回带有访问和刷新令牌的json,然后用户通过api/Account/ExternalLogin端点登录,但在流的末尾,我被重定向到

我无法真正找到流程在何处以及为什么在程序集中设置此特定错误

Startup.Auth.cs如下所示:

public void ConfigureAuth(IAppBuilder app)
    {
        app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

        PublicClientId = "self";
        var tokenTimeSpanInHours = ConfigurationManager.AppSettings["AccessTokenLifeTimeInHours"];

        OAuthServerOptions = new OAuthAuthorizationServerOptions
        {
            Provider = new ApplicationOAuthProvider(PublicClientId),
            TokenEndpointPath = new PathString("/api/token"),
            AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"),
            AccessTokenExpireTimeSpan = TimeSpan.FromHours(Convert.ToInt16(tokenTimeSpanInHours)),
            AllowInsecureHttp = true
        };

        app.UseOAuthBearerTokens(OAuthServerOptions);
        var googleOAuthOptions = new GoogleOAuth2AuthenticationOptions
        {
            AccessType = "offline",
            Provider = new CustomGoogleAuthProvider(),
            ClientId = ConfigurationManager.AppSettings["GoogleAccountClientId"].ToString(),
            ClientSecret = ConfigurationManager.AppSettings["GoogleAccountClientSecret"].ToString()           
        };
        googleOAuthOptions.Scope.Add("profile");
        googleOAuthOptions.Scope.Add("email");
        googleOAuthOptions.Scope.Add("https://www.googleapis.com/auth/gmail.send");
        app.UseGoogleAuthentication(googleOAuthOptions);
    }
那么问题出在哪里呢?我需要一些明确的配置来告诉我需要代码流吗?支持吗

请阅读,看看它是否有帮助(
响应类型,在基本请求中应该是code.