The user was not found in the JWT token, nor in the current virtual context URL.

Geo Neeliyara asked on September 19, 2022 12:57

Hi,

I am getting following error while accessing the page builder on uat enviornment. Local instance its works fine. Kentico Core v13.0.82

An unhandled exception occurred while processing the request. InvalidVirtualContextException: Try reloading the administration interface. The user was not found in the JWT token, nor in the current virtual context URL.

Regards, Geo

Recent Answers


vasu yerramsetti answered on September 20, 2022 12:22

Please check the following -

  1. Is configured correctly Presentation URL (https)
  2. CMSHashStringSalt key same for both CMS and Core application
  3. Clear the browser cache and check it
0 votesVote for this answer Mark as a Correct answer

Geo Neeliyara answered on September 29, 2022 11:53

Hi, I tried different things. finally got resolved.

  1. Check the presentation url
  2. CMSHashStringSalt key same for both CMS and Core application
  3. Reset the macro signature ( under system --> macros --> signatures)
  4. Clear Cahce & Restart Application
  5. Applied latest hotfix
0 votesVote for this answer Mark as a Correct answer

Dilip Kumar answered on May 8, 2023 13:17

Hi, I have migrated my kentico 12 MVC application to Kentico 13 MVC 5 app using https://docs.xperience.io/installation/upgrading-to-xperience-13. Migration is done successfully . But when I page builder - option in Kentico Admin , getting “Try reloading the administration interface. The user was not found in the JWT token, nor in the current virtual context URL.” Error in Kentico Admin on my VS2022 localhost.

I am running app using VS 2022 on localhost and already tried below solution but still keep getting this error.

• I have removed all response security restrictions . • Admin is running on different port and MVC on different port, so I added below key in MVC project.

• I also enabled ssl (https on localhost ) using Vs2002

But I am still getting the same below error

InvalidVirtualContextException: Try reloading the administration interface. The user was not found in the JWT token, nor in the current virtual context URL.] Kentico.Content.Web.Mvc.VirtualContextPrincipalRetriever.GetPrincipal(String jwtToken) +417 Kentico.Content.Web.Mvc.VirtualContextPrincipalAssigner.SetVirtualContextPrincipal(IVirtualContextPrincipalRetriever virtualContextPrincipalRetriever) +229 CMS.Base.AbstractHandler.CallEventHandler(EventHandler1 h, TArgs e) +115 CMS.Base.AbstractHandler.Raise(String partName, List1 list, TArgs e, Boolean important) +1012 CMS.Base.SimpleHandler2.RaiseExecute(TArgs e) +145 CMS.Base.SimpleHandler2.StartEvent(TArgs e) +236 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +223 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +220 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +94

0 votesVote for this answer Mark as a Correct answer

Geo Neeliyara answered on May 8, 2023 13:41

Hi Dilip,

Can you try the following

  1. If you are using different port, please update the site settings accordingly

eg: Administration Domain : localhost:5004 Presentation URL : http://localhost:25291

  1. If you are using https url for presentation then please set the admin url to https as well.

Regards, Geo

0 votesVote for this answer Mark as a Correct answer

Dilip Kumar answered on May 8, 2023 13:56 (last edited on May 8, 2023 13:56)

Hi Geo ,I have already set presentation url https://localhost:44333/ and administration Domain : localhost:44322 under site . Page preview does work but page builder is giving jwt error

0 votesVote for this answer Mark as a Correct answer

Abhishek Mishra answered on September 9, 2023 06:58

I am using octa configuration and when I disable the okta in appsetting.json file, preview page in Admin interface works but Site shows error and when I enable its vice versa.

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 Myapp.Web.UI.Middleware.CultureMiddleware.<>c__DisplayClass3_0.<g__invokeImplementation|0>d.MoveNext() in D:\a\1\s\BackEnd\Myapp.Web.UI\Middleware\CultureMiddleware.cs:line 45 --- End of stack trace from previous location --- at Myapp.Web.UI.Middleware.CultureMiddleware.InvokeAsync(HttpContext httpContext) in D:\a\1\s\BackEnd\Myapp.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)

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.