Use this code snippet below that works fine, just replace ClientID and ClientSecret will work for you.
var googleOptions = new GoogleOAuth2AuthenticationOptions() { ClientId = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", ClientSecret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", Provider = new GoogleOAuth2AuthenticationProvider() { OnAuthenticated = (context) => { context.Identity.AddClaim(new Claim("urn:google:name", context.Identity.FindFirstValue(ClaimTypes.Name))); context.Identity.AddClaim(new Claim("urn:google:email", context.Identity.FindFirstValue(ClaimTypes.Email))); //This following line is need to retrieve the profile image context.Identity.AddClaim(new System.Security.Claims.Claim("urn:google:accesstoken", context.AccessToken, ClaimValueTypes.String, "Google")); return Task.FromResult(0); } } }; app.UseGoogleAuthentication(googleOptions);
if error still exists
Assume your application URI as below
http: // localhost: 2625 /
Then, on console.developers.google.com, the URI that you registered must be changed, as shown below.
Just add [ signin-google ] to the URI at the end
http: // localhost: 2625 / signin-google
And finally save it.

source share