I have an ASSP.NET MVC web application MyWebApp which doesn't allow anonymous access to any page. There is an IdentityServer4 configured and once the user tries to open MyWebApp, he gets redirected to IdentityServer login page. (Hybrid Flow)
The user does not login and stays on that IdentityServer login page for long enough so the Nonce cookie on MyWebApp expires (15min default lifetime).
If he then proceeds with the login in IdentityServer (successful) and gets redirected back to MyWebApp, he gets the following error:
Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectProtocolInvalidNonceException IDX21323: RequireNonce is '[PII is hidden]'. OpenIdConnectProtocolValidationContext.Nonce was null, OpenIdConnectProtocol.ValidatedIdToken.Payload.Nonce was not null. The nonce cannot be validated. If you don't need to check the nonce, set OpenIdConnectProtocolValidator.RequireNonce to 'false'. Note if a 'nonce' is found it will be evaluated.
But since the user was successfully authenticated in IdentityServer, when he tries to access MyWebApp again, he gets redirected to IdentityServer and back to MyWebApp without having to enter username/password again. Yet the initial error is annoying. Anyone ever had such issue when the 'login' flow has started and the user goes 'AFK' for long enough that the 'Nonce' cookie expires and he can't finish the final validation? What would be a good way to handle that scenario?
Thanks in advance!
