Click here to Skip to main content
15,886,736 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am new to MVC 5 authentication. Currently I tried Google Authorization using Owin
The code in startup.Auth.cs
C#
var googleOAuth2AuthenticationOptions = new GoogleOAuth2AuthenticationOptions
{
    ClientId = "Client-id",
    ClientSecret = "secret-key",
    CallbackPath = new PathString("/Account/ExternalLoginCallback"),
    Provider = new GoogleOAuth2AuthenticationProvider()
    {
        OnAuthenticated = async context =>
        {
            context.Identity.AddClaim(new Claim("picture", context.User.GetValue("picture").ToString()));
            context.Identity.AddClaim(new Claim("profile", context.User.GetValue("profile").ToString()));
        }
    }
};
googleOAuth2AuthenticationOptions.Scope.Add("email");

app.UseGoogleAuthentication(googleOAuth2AuthenticationOptions);


But it does not hit ExternalLoginCallback Action.
C#
// GET: /Account/ExternalLoginCallback
       [AllowAnonymous]
       public async Task<ActionResult> ExternalLoginCallback(string returnUrl)


It stop at https://localhost:44307/Account/ExternalLoginCallback?ReturnUrl=%2F with blank white screen.

is there missing something?
Posted
Updated 20-Feb-17 21:16pm

1 solution

Try adding following tag in webconfig AppSetting,

 <appSettings>
       <add key="owin:AutomaticAppStartup" value="false" />
</appSettings>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900