2
我有一個ASP.NET MVC應用程序,我試圖將DotNetOpenAuth用於Google OAuth。我正在使用示例中的GoogleConsumer類,並嘗試執行身份驗證的第一步。下面的代碼是基本相同的是,在提供的WebForms應用程序,只是在MVC控制器:DotNetOpenAuth WebConsumer不會重定向到ASP.NET MVC應用程序中的OAuth提供程序
public string Authenticate()
{
GoogleTokenManager tokenManager = new GoogleTokenManager(ConsumerKey, ConsumerSecret);
WebConsumer webConsumer = new WebConsumer(GoogleConsumer.ServiceDescription, tokenManager);
GoogleConsumer.RequestAuthorization(webConsumer, GoogleConsumer.Applications.Gmail);
return "";
}
當我提出一個AJAX請求到控制器中的代碼執行,但我從來沒有重定向到谷歌網頁進行驗證。