asp.net-mvc-4 - 如何将 MVC 4 OpenId Google 登录迁移到 OAuth 2.0 或 Google+ 登录

标签 asp.net-mvc-4 oauth-2.0 google-plus google-oauth google-openid

我有一个 MVC 4 Web 应用程序,目前正在使用开箱即用的 OpenId Google 登录。这已被谷歌弃用,因此,我需要将其迁移到谷歌支持的方法之一。我已阅读 Google 提供的文档,OpenID 2.0 (Migration) ,但我仍然无法将新的登录方法与我的应用程序集成。

我打算使用 Google 登录的只是电子邮件地址。我不关心从 Google 获取有关用户的任何其他信息。

我的问题是我必须采取哪些步骤才能将我的 MVC 4 Web 应用程序迁移到支持的 Google 登录方法?

注意:在格式化这个问题时,我遇到了这个有希望的信息:Web applications (ASP.NET MVC)

最佳答案

您所要做的就是在 C# 中创建一个 MVC 项目,启用单一授权并使用您的信息编辑文件 Startup.Auth.cs:

app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
{
ClientId = "{your ID}",
ClientSecret = "{your client-secret}"
});

关于asp.net-mvc-4 - 如何将 MVC 4 OpenId Google 登录迁移到 OAuth 2.0 或 Google+ 登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25995653/

相关文章:

javascript - 允许 javascript 访问服务器端变量,MVC4

asp.net - 测试受 [Authorize] 保护的 Web API Controller

google-plus - 添加谷歌评论到网站?

c# - 从页面 MVC4 读取 HTML 元素

asp.net - 任务计划程序 : Schedule multiple tasks to be run in a single scheduler

oauth - 是否可以通过 Google oAuth2 获取电话号码?

ruby-on-rails - 使用 Google Oauth2 客户端访问 API 时 Rails 3.2.3 中的 SSL 错误

iphone - 用户选择共享或取消后,iOS Google+ 应用程序不会返回应用程序

python - Google+ 登录 - 服务器端流程 - Python - Google App Engine

c# - 以编程方式访问 ASP.NET MVC4 上的文件