HttpContext.User is randomly lost after successful authentication on Service Fabric
<p>I have an ASP.NET Core Application running on Service Fabric(3 nodes) that requires users to authenticate themselves through microsoft to gain access to their O365 environment. Once the authentication is succesful, they are redirected to my app and the user's info are stored into a cookie which contains a certain role(like admin):</p>

<pre><code>        var claims = new List&lt;Claim&gt; {
            new Claim(ClaimTypes.GivenName, authResult.UserInfo.GivenName, ClaimValueTypes.String),
            new Claim(ClaimTypes.Name, authResult.UserInfo.FamilyName, ClaimValueTypes.String),
            new Claim(ClaimTypes.Email, authResult.UserInfo.DisplayableId, ClaimValueTypes.String),
            new Claim("aud", userId, ClaimValueTypes.String),
            new Claim(ClaimTypes.Role, "Office365Admin", ClaimValueTypes.String)
        };
</code></pre>

<p>And here is how I setup the cookie middleware:</p>

<pre><code>        await HttpContext.Authentication.SignInAsync("MyCookieMiddlewareInstance", userPrincipal,
            new AuthenticationProperties
            {
                ExpiresUtc = DateTime.UtcNow.AddMinutes(20),
                IsPersistent = true,
                AllowRefresh = true
            });
</code></pre>

<p>and then I use a typical authorize on my other controller methods to make sure that the user who is requesting this method as the correct role to do so:</p>

<pre><code>        [Authorize(Roles = "Office365Admin")]
</code></pre>

<p>This works perfectly fine on my local environment (1 to 5 nodes) but once I go to my 3 nodes azure cluster, the user gets randomly redirected to my LoginPath (which means the incoming request's cookie does not contain the right role, or at least the server does not recognize it). And this seems to be happening at random, I can fo 4-5 requests without this happening, or this could happen for all the requests sent for 10 seconds. I figure this might be some load balacing issue since disabling 2 of the 3 nodes seems to be solving the issue, but this is not a reliable solution.</p>