Google Authorization in ASP.Net MVC 6

Michał Smyk
Jan 3, 2016 · 3 min read
public void ConfigureServices(IServiceCollection services) { (…) services.AddMvc(); (…) }public void ConfigureServices(IServiceCollection services)
services.AddMvc(options => { options.Filters.Add(new Microsoft.AspNet.Mvc.RequireHttpsAttribute()); });services.AddMvc(options =>options.Filters.Add(new Microsoft.AspNet.Mvc.RequireHttpsAttribute());
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
(...)
app.UseIdentity();
app.UseGoogleAuthentication(options =>
{
options.ClientId = Configuration["Authentication:Google:ClientId"];
options.ClientSecret = Configuration["Authentication:Google:Secret"];
});
(...)
}
{ 
“Authentication:Google:ClientId”: “someId”,
“Authentication:Google:Secret”: “someSecret”
}

Smyk.IT

Blog of Software Engineer from Wrocław, Poland

Michał Smyk

Written by

.NET Software developer from Poland.

Smyk.IT

Smyk.IT

Blog of Software Engineer from Wrocław, Poland