I've got a nearly stock ASP.NET MVC template application from Visual Studio 2013. It was created using the following settings:
Create > Project > Web > ASP.NET Web Application > OK > MVC, Individual User Accounts > OK
I'm attempting to log in using the OWIN Google provider and having issues.
OWINs Configuration
method looks like this:
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);
I click the Google
provider button on the web page, authenticate with google, get referred back to ExternalLoginCallback
. At this point, the process breaks down at this line:
var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync();
loginInfo is null
, which redirects me back to the Login page without any visible errors.
I'm responding to an old question here, but for anyone in the future who may encounter this problem, the solution that worked for me was to enable the "Google+ API" using the API Manager from the Google Developers Console.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With