How to get access_token of the UiPath Orchestrator External App in Microsoft Power Automate?
Issue Description
Let's assume that you have created a confidential application with application scopes for the UiPath.Orchestrator resource and you want to get the access_token in order to perform other UiPath Orchestrator actions using the available API endpoints. See the below image for reference:
References:
- API References
- Using OAuth for External Apps
- Permissions Per Endpoint
- Swagger documentation for on-premise: https://myOrchestrator.com/swagger/index.html
- Swagger documentation for Automation Cloud: https://cloud.uipath.com/{organization_ID}/{tenant_name}/orchestrator_/swagger/index.html
- Swagger documentation for Automation Suite: https://AutomationSuiteURL/{organization_name}/{tenant_name}/orchestrator_/swagger/index.html
Resolution
In order to be able to extract the access_token, the HTTP request connector should look like the below:
Approach #1
- Method: POST
- URI: https://cloud.uipath.com/identity_/connect/token
- Headers: Content-Type application/x-www-form-urlencoded
- Body: Concat(
'grant_type=client_credentials',
'&client_id=',encodeUriComponent('xxxxxxxxxxxxxxxx),
'&client_secret=',encodeUriComponent('xxxxxxxxxxxxx'),
'&scope=',encodeUriComponent('OR.Queues'))
Approach #2
- Method: POST
- URI: https://cloud.uipath.com/identity_/connect/token
- Headers: Content-Type application/x-www-form-urlencoded
- Body: grant_type=client_credentials&client_id=YOUR_CLIENT_ID&scope=OR.License%20OR.Robots%20OR.Jobs%20OR.Settings%20OR.Assets%20OR.Robots%20OR.Folders%20OR.Execution%20OR.Monitoring%20OR.Administration%20OR.Queues&client_secret=YOUR_CLIENT_SECRET