Good morning.
I’m developing a Blazor Server application with framework .NET 10 that requires Okta authentication.
Although I’ve followed all the instructions, after authentication I still receive the following error message: “OpenIdConnectAuthenticationHandler: message.State is null or empty.”
The application runs in https, cross-origin third-party cookies are enabled, and the application settings on the Okta website are consistent with the application code.
Has anyone encountered and solved this problem?
Hi,
This may be due to the correlation cookie not making it back to the app on the callback. A few things worth checking:
-
Try explicitly setting the correlation/nonce cookies in your AddOpenIdConnect config:
options.CorrelationCookie.SameSite = SameSiteMode.None;
options.CorrelationCookie.SecurePolicy = CookieSecurePolicy.Always;
options.NonceCookie.SameSite = SameSiteMode.None;
options.NonceCookie.SecurePolicy = CookieSecurePolicy.Always;
-
Clear site cookies before retrying.
Enabling debug logging on Microsoft.AspNetCore.Authentication can also help pinpoint which cookie is missing.