I am building a simple Blazor Server-side App. I followed the steps mentioned in the blog - Blog to setup Auth0 authentication.
Things work fine as long as I am on localhost in debug mode.
The moment I published the app to the local IIS server, I started getting error the moment I clicked on the login button. On checking the windows event viewer, I noticed that the cookie sent by login was discarded and that threw an exception.
Before this, I can see a warning that says that the cookie has set SameSite=None and so it must set ‘secure’.
I have since then tried multiple changes in the Program.cs to handle this but none of the settings worked.
Things that I have tried -
- Adding the following setting -
builder.Services.ConfigureApplicationCookie(options => {
options.Cookie.SameSite = SameSiteMode.None;
});
- Adding a custom class to handle this situation as suggested in the blog - Thinktecture
Both these work fine in localhost debug mode but give same error as above when deployed to local IIS.
Any help to sort this out is very much appreciated!