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

问题描述 投票:2回答:2

我正在尝试使用Google身份验证API在我的Web 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时显示

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

之所以这样,是因为我遵循了kudvenkat教程中的所有步骤,但仍然遇到此错误。我做错了吗

请注意,我在此google登录名上使用的凭据在我的数据库中不存在(如果有的话)

asp.net api asp.net-web-api google-authentication
2个回答
0
投票

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


0
投票

同一问题:(我遵循相同的youtube vid并面临相同的问题

© www.soinside.com 2019 - 2024. All rights reserved.