Created
September 2, 2017 13:35
-
-
Save frazelamont/cfee30452deff2713e8b32b2e6dded9c to your computer and use it in GitHub Desktop.
.netCore - use user secrets or app settings for google+ authentication
This file contains hidden or 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
| // This method gets called by the runtime. Use this method to add services to the container. | |
| public void ConfigureServices(IServiceCollection services) | |
| { | |
| // add facebook login, more too soon - changed in netcore v2 | |
| if (_isDevelopment) | |
| { | |
| services.AddAuthentication() | |
| .AddGoogle(googleOptions => | |
| { | |
| googleOptions.ClientId = Environment.GetEnvironmentVariable | |
| ("Authentication:Google:ClientId"); | |
| googleOptions.ClientSecret = Environment.GetEnvironmentVariable | |
| ("Authentication:Google:ClientSecret"); | |
| }); | |
| } | |
| else | |
| { | |
| services.AddAuthentication() | |
| .AddGoogle(googleOptions => | |
| { | |
| googleOptions.ClientId = Configuration["Authentication:Google:ClientId"]; | |
| googleOptions.ClientSecret = Configuration["Authentication:Google:ClientSecret"]; | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment