Skip to content

Instantly share code, notes, and snippets.

@marcosdeaguiar
Created May 20, 2020 18:03
Show Gist options
  • Save marcosdeaguiar/d66db77e141c6d46e71423df50112fec to your computer and use it in GitHub Desktop.
Save marcosdeaguiar/d66db77e141c6d46e71423df50112fec to your computer and use it in GitHub Desktop.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
// Add other services...
services.AddAntiforgery(options => {
options.HeaderName = "X-XSRF-TOKEN";
options.Cookie = new CookieBuilder()
{
Name = "XSRF"
};
});
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie();
// Add MVC, SPA and son on....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment