【发布时间】:2016-08-09 19:55:50
【问题描述】:
我尝试使用 Microsoft 和 Google 身份验证服务对我的用户进行身份验证。 Microsoft Service 可以正常工作,但我使用 google one 有问题。
总结一下我的解释,我在谷歌控制台管理器中做了以下任务:
- 启用 google+ API(甚至 google+ 域 API)。
- 向我的项目添加两个重定向 URL:http://{my website}/signin-google , http://{my website}/account/externallogincallback
我配置我的网络应用程序如下:
var googleOAuth2AuthenticationOptions = new GoogleOAuth2AuthenticationOptions
{//www.mylocal.com Site clientId
ClientId = "my client Id",
ClientSecret = "my secret",
};
app.UseGoogleAuthentication( googleOAuth2AuthenticationOptions);
问题是: 当用户尝试使用 google 登录时,它会成功重定向到 google 授权页面,但是当他授权我的应用程序时,他会重定向到我的回调,但我的应用程序无法访问他的数据。
您可以使用以下链接查看我的网站问题。
【问题讨论】:
-
我从未尝试过使用 GoogleOAuth2AuthenticationOptions 但如果您不添加任何范围,我认为您将无法访问任何数据。
-
我应该搜索你的回复。@DalmTo
-
或者给我几分钟的时间来玩一下它,或者查看 Google .net 客户端库,由你决定:)
-
尝试添加这个:googleOAuth2AuthenticationOptions.Scope.Add("profile");
-
我测试了 3 种不同的示波器。但没有用。
标签: asp.net-mvc oauth-2.0 google-oauth owin google-authentication