How to use UiPath External Application with Application Scopes, in Power Automate?
First create a new External Application is your UiPath Automation Cloud or On-Premise Orchestrator and assign the required User Scope(s) as described in the below documentation:
- Managing external applications (UiPath Automation Cloud)
- Managing external applications (Orchestrator On-Premise)
The UiPath External Application properties should look like this:
Example: How to use HTTP actions in Power Automate to retrieve your Orchestrator Folders.
Note: The example is for Automation Cloud. For On-Premise Orchestrator the URIs are slightly different. Check Using OAuth For External Apps for more information.
- Go to Power Automate and create a new flow
- Use a HTTP action to generate the access token
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={UiPathAppID]&client_secret={UiPathAppSecret]&scope={UiPathAppScopes}
The action should look like this:
Note: As a best practice, avoid adding your App ID and App Secret in plain text.
The output of this HTTP action will look as below:
- Use the access token
Add a second HTTP request (in this example we will get the Orchestrator folders)
Method: GET
URI: https://cloud.uipath.com/{yourOrganizationName}/{yourTenantName}/orchestrator_/odata/Folders
Headers:
Authorization
|
Bearer {access_token}
|
Accept
|
application/json
|
Note: To extract the access token from the HTTP action that generated it, use the following expressions:
"body('HTTP_-_Generate_Access_Token')['access_token']", where "HTTP_-_Generate_Access_Token" is the name of the previous HTTP action.
Example response:
The whole flow looks as below:
For all the available API requests in UiPath, check API References.