我有一个来自Visual Studio 2013的几乎标准的ASP.NET MVC模板应用程序。它是使用以下设置创建的:
OWIN的
我在网页上点击了
我正在尝试使用OWIN Google提供程序进行登录,并遇到问题。创建 > 项目 > Web > ASP.NET Web应用程序 > 确定 > MVC,单个用户帐户 > 确定
OWIN的
Configuration
方法如下: app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
var google = new Microsoft.Owin.Security.Google.GoogleOAuth2AuthenticationOptions
{
ClientId = "xxxxx.apps.googleusercontent.com",
ClientSecret = "xxxxxxxxx-yyyyyyyyy"
};
google.Scope.Add("profile");
google.Scope.Add("email");
app.UseGoogleAuthentication(google);
我在网页上点击了
Google
提供商按钮,使用谷歌进行身份验证,然后被引导回到ExternalLoginCallback
页面。在这一点上,该过程在以下行中停止:
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
loginInfo
为空,这将使我被重定向回登录页面,而没有任何可见的错误。