How to Setup Data Service Through API ? how to get Bearer token using UI Path Studio?


How to perform the OAuth 2.0 request in UiPath?
I am able to perform the same request in Postman using the following parameters:
I am attaching a screenshot of the parameters which I provided in Postman.

  1. Grant Type: Authorization Code (With PKCE)
  2. Callback URL
  3. Auth URL
  4. Access Token URL
  5. Client ID
  6. Code Challenge Method: SHA-256
  7. Scope

Please help me as soon as possible

If you’re building a UiPath Robot to connect to UiPath Cloud and fetch data via APIs, you’ll need to create a Confidential application with Application scopes. Use the Client ID and Client Secret to authenticate with UiPath Cloud to obtain an access token, and make subsequent API calls using that token. Reference for authentication: Orchestrator - Accessing UiPath Resources Using External Applications

Make a HTTP POST call to the https://cloud.uipath.com/identity_/connect/token endpoint and with a request body "client_id={your_client_id}&client_secret={your_client_secret}&grant_type=client_credentials&scope={your_requested_scopes}", and the response body will include an access_token property.

refer to the below link for details on using UiPath data service API
https://docs.uipath.com/data-service/automation-cloud/latest/user-guide/api-access

refer the below link for managing external applications
https://docs.uipath.com/automation-cloud/automation-cloud/latest/api-guide/accessing-uipath-resources-using-external-applications


I am getting this invalid Request as a reponse.
kindly guide me.

I tried in body x-www-form-urlencoded also but still getting invalid request.

Use x-www-form-urlencoded with this request body, client_id={your_client_id}&client_secret={your_client_secret}&grant_type=client_credentials&scope={your_requested_scopes}