Connection Of Robot To Orchestrator Failed With Error "An error has occurred"

How to resolve when the connection of Robot with Orchestrator Failed with Error "An error has occurred"?

Issue Description: Robot connection failed with Error : “An Error has occured”. in version 20.4 Studio/Robot or higher. Error : System.InvalidOperationException: No authentication handler is registered for the scheme ‘Windows’.

This issue is seen due to misconfiguration of Windows Authentication in Orchestrator.

Capture the Event Viewer logs in the Orchestrator machine to understand the exception when the API call is made to the server for the connection.

The registered schemes are: UiRobot, BasicAccessToken, UiRobotAccessToken, IdentityUserAccessToken, LicenseKey, Identity.Application, Identity.External, Identity.TwoFactorRememberMe, Identity.TwoFactorUserId, UiPath.Windows, SystemOpenIdConnect.

Invoke AddAuthentication().AddSomeAuthHandler

Also, Disable Windows Authentication from UiPath.Orchestrator.dll file using the below key and validate if the connection is being established.

If enabling windows Authentication needs to be performed, revalidate all the steps correctly from Configuring SSO : Active Directory .