In the Insights Event Viewer logs, the following error is observed, "UiPath.Services.Authentication.Common.UiPathHttpClientException: Failed to obtain access token" .
Issue Description: In the Insights Event Viewer logs, the following error is observed,
- "UiPath.Services.Authentication.Common.UiPathHttpClientException: Failed to obtain access token." .
An unhandled exception has occurred while executing the request. UiPath.Services.Authentication.Common.UiPathHttpClientException: Failed to obtain access token. at UiPath.Services.ClientAuthenticationModule.UiPathHttpMessageHandler.GetAccessTokenAsync(String tokenEndpoint, CancellationToken cancellationToken)
This error can be thrown be from Either the UiPath Insights - Provisioning or the UiPath Insights - InsightsPortal service.
Root Cause: When the Insights service starts up, it needs to authenticate to the identity provider ( Identity service which is typically bundled with Orchestrator). Authentication should be performed so that it can:
-
Verify users who are connecting to Insights
-
It is also authenticating itself so it can query information from Orchestrator for things like provisioning Orchestrator tenants in Insights. (Basically it needs to know the logical distinction between tenants so it can make the same logical distinction between the data ingested into Insights and also to make sure that users only have see information relevant to their tenant).
Diagnosing
- This error will typically occur when there is a problem with the Identity server
- Reproduce the issue and check the Identity server logs (The Identity server is deployed on the Orchestrator server)
- First restart IIS on the Insights server.
- From an admin command prompt: iisreset
- After restarting IIS, reproduce the error
- Note the timestamp when the error occurs.
- After the error has been reproduced, login to the identity server and check the event logs:
- For Azure App Deployment see: Enable Logs On Identity Azure App Service
- Azure Portal -> Advanced Tools -> On Kudu, go to Tools -> Diagnostic Dump
- Search for the error on the Identity Server logs.
- First restart IIS on the Insights server.
- Search the Identity Event logs for the error ( filter by Identity, but if capturing the logs leave them unfiltered)
- If the issue is not clear, they need to open a ticket with UiPath and include
- Insights Event logs
- Identity / Orchestrator Event logs
- Timestamps.