Sitecore Horizon "OpenIdConnect" was not authenticated. Failure message: "Not authenticated"

If you want to install Horizon and facing some pre-post installation issues and looking for fixes, then my previous blogs can help you.

Install Horizon 10.2 with Sitecore XM

Sitecore Horizon Issue Pre and Post installation

Horizon

Error:

horizon-open-id-connect

Go to the log file path of Horizon C:\inetpub\wwwroot\horizon.sc102.local\logs, and open the log file.

Detailed Error:

2022-09-02T18:10:56.9438516+08:00 [INF] (Sitecore Authoring Host/HIMMATDULAWAT) Request finished in 5276.6077ms 500
2022-09-02T18:11:47.6373868+08:00 [INF] (Sitecore Authoring Host/HIMMATDULAWAT) Request starting HTTP/1.1 GET http://horizon.sc102.local/composer/pages
2022-09-02T18:11:47.6391440+08:00 [INF] (Sitecore Authoring Host/HIMMATDULAWAT) "OpenIdConnect" was not authenticated. Failure message: "Not authenticated"
2022-09-02T18:11:52.9076810+08:00 [ERR] (Sitecore Authoring Host/HIMMATDULAWAT) Connection id ""0HMKCPCNM85JC"", Request id ""0HMKCPCNM85JC:00000002"": An unhandled exception was thrown by the application.
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'.
---> System.IO.IOException: IDX20807: Unable to retrieve document from: 'System.String'. HttpResponseMessage: 'System.Net.Http.HttpResponseMessage', HttpResponseMessage.Content: 'System.String'.
at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
--- End of inner exception stack trace ---
at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleChallengeAsyncInternal(AuthenticationProperties properties)
at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleChallengeAsync(AuthenticationProperties properties)
at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.ChallengeAsync(AuthenticationProperties properties)
at Microsoft.AspNetCore.Authentication.AuthenticationService.ChallengeAsync(HttpContext context, String scheme, AuthenticationProperties properties)
at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Sitecore.Plugin.Authentication.ErrorHandling.AuthenticationExceptionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
2022-09-02T18:11:52.9124970+08:00 [INF] (Sitecore Authoring Host/HIMMATDULAWAT) Request finished in 5274.9918ms 500

Solution: From the detailed error log, the issue is more related to OpenIdConnect and Authoring. I have checked the OpenIdConnect.xml file from the path in the horizon directory i.e. C:\inetpub\wwwroot\horizon.sc102.local\Config and opened the file.

In this file, you can find that configuration is related to the Identity Server URL, which means the Sitecore Identity Server is not working. As the Sitecore Horizon interface is login worked automatically by Sitecore SSO with Identity Server.

In my case, my Sitecore Licence expired and I have updated it to all instances except Identity Server, So after updating the Sitecore Licence file on Sitecore Identity Server, it started working fine without any error.

Go to the path C:\inetpub\wwwroot\sc102identityserver.local\sitecoreruntime and update the licence.

Happy Sitecoreing 😊

Comments

Popular posts from this blog

Sitecore Installation Error: Failed to Start Service 'Sitecore Marketing Automation Engine'

Import CSV Data in Sitecore Using PowerShell: Part-3

Error: Method Through Reflection is Not Allowed after Applying Sitecore Hotfix