-
-
Save thomaslevesque/fe2cb14377e30833484f75ac416134bb to your computer and use it in GitHub Desktop.
Google authentication in ASP.NET Core with the built-in provider vs. with OpenId Connect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Before | |
services | |
.AddAuthentication() | |
.AddGoogle(options => | |
{ | |
options.ClientId = configuration["Authentication:Google:ClientId"]; | |
options.ClientSecret = configuration["Authentication:Google:ClientSecret"]; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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