Configure Domain_hint in asp.net core

This took me way to much time to figure out since there is a ton of old information on the internet. I wanted to change the default behavior when people are logging in to my ASP.NET Core website using Azure Active Directory (or Microsoft Identity Platform). After some searching I figured out how to change this setting.

You have to add the following piece of code to the ConfigureService method in your Startup.cs

services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
{
     options.Events = new OpenIdConnectEvents
     {
         OnRedirectToIdentityProvider = async context =>
         {
             context.ProtocolMessage.DomainHint = "demo.hoekstraonline.net";
             await Task.Yield();
         },
     };
});
Same trick works for Login_Hint

Hope this saves me some time next time I am looking for this information.