IdentityServer Login with external provider not working for long login_hint or acr_values IdentityServer Login with external provider not working for long login_hint or acr_values asp.net asp.net

IdentityServer Login with external provider not working for long login_hint or acr_values


I can't be sure, but, this sounds like it may be a max cookie size problem.
Cookies can only store 4096 bytes in most browsers, and if cookies are stored in UTF-32 for example, then 1024 characters would take up all of that space and your cookie would be truncated.

You may want to try overriding one of the CookieOptions properties in the AuthenticationOptions.

In the CookieOptions class you can provide an IAuthenticationSessionStoreProvider. According to the comment on the property it may be the solution you are looking for, at the very least you may be able to debug what is going wrong.

/// <summary>///   An optional container in which to store the identity across requests.///   When used, only a session identifier is sent///     to the client. This can be used to mitigate potential problems ///     with very large identities./// </summary>public IAuthenticationSessionStoreProvider SessionStoreProvider { get; set; }

There is no default implementation for IAuthenticationSessionStoreProvider but you can look at how it is used inside AuthenticationSessionStoreWrapper

It is wrapped up inside an AuthenticationSessionStoreWrapper if you add a provider:

static IAuthenticationSessionStore GetSessionStore(IAuthenticationSessionStoreProvider provider){    return provider != null ? new AuthenticationSessionStoreWrapper(provider) : null;}