How to request an Access Token for API in UiPath. It works in Postman, not in Studio!

I want to get the access token from an API. I have the following information in a Postman Collection that was sent to me:

  1. client_id (body:form-data)
  2. client_Secret (body:form-data)
    3.grant_type (body:form-data)
  3. content_type:application/json (header)

No authorization is being done separately within postman

image

Within UiPath I have tried:

  1. passing in the client details as body: "{'client_id': 'CLIENT_ID','client_secret': 'CLIENT_SECRET','grant_type': 'client_credentials'}"
  2. Passing in client details as parameters
  3. Body + Parameter
  4. Body + client certificate and password (using client_id and client_secret)

I get 200 response with no content when passing them as parameters and no body

Please help!

Create an access token to use in any process activity or form control in a specified app.
Click App Builder.
In the Application Explorer, on the My Apps pane, click [App Name] > Shared Resources > Access Tokens.
Click New.
On the New Access Token screen, select UiPath.
Click Next.

This may help you,
Rachel Gomez

Check if this is working (add those details in the Parameters section):

The EndPoint should look like "https://cloud.uipath.com/identity_/connect/token"

hey Rachel, this is not for generating an access token to access UiPath

As I said in point #2, I have tried 2. Passing in client details as parameters. Furthermore this is not to access any UiPath service

When you attempted providing your JSON Object in the Body, did you use single quotes or double quotes around the Value:Key Pairs? JSON Specification uses double quotes and would be invalid otherwise.

In Postman does switching it from form-data to raw with the JSON Object in Body successful?

Go UiPath Orchestrator–> Admin

Select the Tenant and click Services. In Orchestrator, click the 3-dot button and click API Access

Copy User Key, Tenant Name and Client ID.

Create a Post request to “https://account.uipath.com/oauth/token” and set the Authorization to No Auth.

In Header, set Content-Type to application/json and X-UiPath-TenantName to copied Tenant Name.

In the body, paste the following,

{
“grant_type”: “refresh_token”,
“client_id”: “copied Client ID”,
“refresh_token”: “copied User Key”
}

Now send the request, It worked for me.

hi can you share the xaml on this http request

Thanks & Regards