Instantly share code, notes, and snippets.

Embed
What would you like to do?
Google authentication in ASP.NET Core with the built-in provider vs. with OpenId Connect
// Before
services
.AddAuthentication()
.AddGoogle(options =>
{
options.ClientId = configuration["Authentication:Google:ClientId"];
options.ClientSecret = configuration["Authentication:Google:ClientSecret"];
});
// After
services
.AddAuthentication()
.AddOpenIdConnect(
authenticationScheme: "Google",
displayName: "Google",
options =>
{
options.Authority = "https://accounts.google.com/";
options.ClientId = configuration["Authentication:Google:ClientId"];
options.CallbackPath = "/signin-google";
options.SignedOutCallbackPath = "/signout-callback-google";
options.RemoteSignOutPath = "/signout-google";
options.Scope.Add("email");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment