Cannot authenticate to Orchestrator API via OAUTH2 for External apps

I’m following the guide here:

My application is external, with an Application scope, so naturally I’m following the Client Credentials section of the instructions, which states simply to send a POST request to https://cloud.uipath.com/identity_/connect/token with the body:
{
“grant_type”: “client_credentials”,
“client_id”: “{app_id}”,
“client_secret”: “{app_secret}”,
“scope”: “{scopes}”
}

I’m getting a {“error”:“invalid_request”} response back. I’ve also tried setting the content type to application/x-www-form-urlencoded but it doesn’t work. What am I missing? Do I have to add some extra headers?

1 Like

I’m having the EXACT same issue. If you solve the problem before me any help would be appreciated.

@AlexCo I managed to solve the problem. There’s another step that’s need on top of setting the content type in your header to application/x-www-form-urlencoded. Your body has to also be in the expected x-www-form-urlencoded format. Here’s a stack overflow link to setup your body as a x-www-form-urlencoded payload: javascript - How do I POST a x-www-form-urlencoded request using Fetch? - Stack Overflow

1 Like

Hey @AlexCo @Millet_Uraeus

Kindly check this thread - Cloud API Access - #12 by Nithinkrishna

Thanks
#nK

Thanks @Nithinkrishna and @Millet_Uraeus, you both helped me figure it out. I’m just writing this out here for other people who are searching for this.
For the body, I used this format instead of json:

grant_type=client_credentials&client_id=[‘ClientID’]}&client_secret=[‘ClientSecret’]}&scope=[‘Scopes’]

2 Likes

Cool buddy @AlexCo :grinning::+1:

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