Hi @Violetta Bulatevich ,
From your description, it looks like the issue is happening at the /signin-oidc endpoint during OpenID Connect sign-in in certain environments. A few things to note:
Possible causes
- Cookie or session issues
- Since incognito or clearing cache helps some users, this often points to cookie corruption or size issues.
- Microsoft Identity sets a correlation cookie during login. If the cookie is too large or blocked, you may see random 502s.
- Load balancer or gateway behavior
- Even if you don’t use Nginx, some cloud providers inject proxies/load balancers that might interfere with headers or cookies.
- 502 from
signin-oidcoften indicates the request can’t be processed upstream.
- Token cache or session size
- Using
InMemoryTokenCaches()can cause issues in a multi-instance deployment. Tokens may not be shared between instances, leading to failed logins for some users. - If your deployment is scaled out, consider distributed token caching (e.g.,
Microsoft.Identity.Web.TokenCacheDistributed).
- Using
Recommended actions
- Enable logging for Microsoft Identity
services.AddLogging(builder =>
{
builder.AddDebug();
builder.AddConsole();
builder.SetMinimumLevel(LogLevel.Debug);
});
Check logs around Correlation failed or RemoteFailure.
- Check cookie size limits
- Avoid storing too much info in cookies (claims, tokens).
- In ASP.NET Core, you can increase cookie size limits if needed.
- Consider distributed cache for token storage if deployed in multiple instances (Redis, SQL, etc.).
- Test removing browser extensions or corporate policies that may block cookies, since it’s user-specific.
- Collect detailed error info:
Users can capture network traces (F12 > Network tab) and look at the
/signin-oidcrequest to see if cookies or headers are being dropped.
This usually resolves random 502s for OpenID Connect in deployed apps.
Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.