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);
// GET: /Account/ExternalLoginCallback [AllowAnonymous] public async Task<ActionResult> ExternalLoginCallback(string returnUrl)
<appSettings> <add key="owin:AutomaticAppStartup" value="false" /> </appSettings>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)