Auth issue when trying to add a response to a queue via Power Automate

Hello.

I’m trying to add an item to a queue using Microsoft Forms and Power Automate.
The issues starts when the flow is actually trying to send the response to the queue in Orchestrator.
Basically, I have tried 2 types of approach for authentication, and both of them retrive the access token successfully, which I need for the last API call to Orchestrator.
But when it executes the last HTTP Request, it says the following:

{ "message": "You are not authenticated!", "errorCode": 0, "result": null, "targetUrl": null, "success": false, "error": { "code": 0, "message": "You are not authenticated!", "details": "You should be authenticated (sign in) in order to perform this operation.", "validationErrors": null }, "unAuthorizedRequest": true, "__abp": true }

Flows are using the following for the authentication:

First flow:

  • URI

    https://account.uipath.com/oauth/token
    
  • Headers:

    1. Content-Type : application/json
    2. X-UiPath-TenantName : DefaultTenant
  • Body:
    { "grant_type": "refresh_token", "client_id": "qwerty1234", "refresh_token": "abcdef9876" }

Second flow:

  • URI

    https://cloud.uipath.com/identity_/connect/token
    
  • Headers:

    1. Content-Type: application/x-www-form-urlencoded
  • Body:
    grant_type=client_credentials&client_id=qwerty1234&client_secret=abcdef9876&scope=OR.Queues%20OR.Queues.Write

The both variants work just fine, and in the Output I can see the Bearer (access token), as it follows:

{
  "access_token": "eyJhbGciOi....",
  "id_token": "eyJhbGciO...",
  "scope": "openid profile email offline_access",
  "expires_in": 86400,
  "token_type": "Bearer"
}

However, the error occurs at the last HTTP Request, as you can see in the snip below.:

Now, its worth mentioning that I have also set the External Application for Power Automate, using the application scopes ‘OR.Queues OR.Queues.Write’.

Do you have any advice/idea why this is happening? I was trying to figure it out for the last 3 days but I still don’t get it.
Any response will be appreciated! Thanks a lot!

@mihaelab

In add queue item header did you add the authorization? With Bearer <token>

Also did you happen to add application scope only in external application?

And I hope you fid not add any redirect url as well

Cheers

Hello Anil, yes, in the add queue item HTTP Req I have added the Authorization header, as you can see in the snip below:
image

Also, in the external application I’ve set only Application scope, without any User scopes.
And yes, the Redirect URL is empty.

Any ideas? Thanks a lot!

Check for reference these articles:

https://uipath-survey.secure.force.com/CaseView/articles/Knowledge/How-to-use-UiPath-External-Application-with-User-Scopes-in-Power-Automate?lang=en_US

https://uipath-survey.secure.force.com/CaseView/articles/Knowledge/How-to-use-UiPath-External-Application-with-Application-Scopes-in-Power-Automate?lang=en_US

Hello Marian, that’s what I did step-by-step for the second flow, as I wrote in the initial post. It’s still getting me that ‘You are not authenticated!’ error…

@mihaelab

Are you on classic?

it looks like wrong url and also you need to give org id

your url shoudl be the orch url + the odata/etc

cheers

First of all, the URL address is not correct. It should start with https://cloud.uipath.com/your_org_name/your_tenant_name.

Read carefully the articles.

It seems that you were both right, the URL was like Tenant_Name/Tenant_Name instead of Organization_Name/Tenant_name and also the Organization Unit ID header was missing. Now it’s woking just fine.

Thanks a million for this!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.