I'm trying to run Kentico 13 CMS in preview mode but i'm getting the following error.
An unhandled exception has occurred while executing the request.
Message: Try reloading the administration interface. The user was not found in the JWT token, nor in the current virtual context URL.
Exception type: CMS.Helpers.InvalidVirtualContextException
Stack trace:
at Kentico.Content.Web.Mvc.VirtualContextPrincipalRetriever.GetPrincipal(String jwtToken)
at Kentico.Content.Web.Mvc.VirtualContextRequestPrincipalRetriever.Retrieve(HttpRequest request)
at Kentico.Web.Mvc.AuthenticationHandler.HandleAuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at IMPlus.Web.UI.Middleware.CultureMiddleware.<>c__DisplayClass3_0.<g__invokeImplementation|0>d.MoveNext() in C:\Users\inraja03\source\repos\IM Plus\BackEnd\IMPlus.Web.UI\Middleware\CultureMiddleware.cs:line 45
--- End of stack trace from previous location ---
at IMPlus.Web.UI.Middleware.CultureMiddleware.InvokeAsync(HttpContext httpContext) in C:\Users\inraja03\source\repos\IM Plus\BackEnd\IMPlus.Web.UI\Middleware\CultureMiddleware.cs:line 28
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Kentico.Content.Web.Mvc.ContentOutputMiddleware.InvokeAsync(HttpContext context)
at Kentico.Web.Mvc.KenticoRequestLocalizationMiddleware.InvokeAsync(HttpContext context)
at Kentico.Content.Web.Mvc.PageRedirectionContextMiddleware.InvokeAsync(HttpContext context)
at Kentico.Web.Mvc.KenticoRequestEventsMiddleware.InvokeAsync(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
Few things which i observed
We have integrated Okta SSO authentication on live site. It works
fine when i disable Okta. I am able to view the page under preview
mode after i have disabled Okta.This issue occurs only in our UAT and Prod instance not in
development instance. Our Admin site and Live Site are mapped under the same domain.