WEB API Google身份验证访问被拒绝

时间:2017-06-26 01:56:33

标签: asp.net api asp.net-web-api google-authentication

我正在尝试使用Google认证API在我的网络API项目上进行Google登录。创建了OAuth

enter image description here

我启用了Google+ API

enter image description here

Client ID

上添加了Client SecretStartup.Auth
app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
        {
            ClientId = "497652290327-gd5h0lrheuqcrtccp2c4rqi8dt5vpfb8.apps.googleusercontent.com",
            ClientSecret = "sPGGSo2d7VZX7YnRNGmCPQDv"
        });

但是当我尝试登录URI dispalys

http://localhost:54388/#error=access_denied

它消耗了我,因为我遵循了kudvenkat教程中的每一步,但仍然遇到此错误。我做错了什么

请注意,我在此Google登录时使用的凭据在我的数据库中不存在(如果这很重要)

1 个答案:

答案 0 :(得分:0)

如果使用代码优先,请确保您具有最新的OWin / FacebookAuth Nuget程序包,并且您的应用程序具有与应用迁移的SQL数据库的有效连接字符串。 还要检查clientID和secret是否正确,在google API控制台上它应该在客户端应用程序上显示一些流量