【发布时间】:2011-08-12 15:48:59
【问题描述】:
我有一个 ASP.NET MVC 应用程序,我正在尝试将 DotNetOpenAuth 用于我的 Google OAuth。我正在使用示例中的 GoogleConsumer 类,并尝试执行身份验证的第一步。下面的代码与提供的 WebForms 应用程序中的代码基本相同,只是在 MVC 控制器中:
public string Authenticate()
{
GoogleTokenManager tokenManager = new GoogleTokenManager(ConsumerKey, ConsumerSecret);
WebConsumer webConsumer = new WebConsumer(GoogleConsumer.ServiceDescription, tokenManager);
GoogleConsumer.RequestAuthorization(webConsumer, GoogleConsumer.Applications.Gmail);
return "";
}
代码在我向控制器发出 AJAX 请求时执行,但我从未被重定向到 Google 页面进行身份验证。
【问题讨论】:
标签: asp.net-mvc dotnetopenauth google-authentication