Consuming APIs with the new Cloud Orchestrator

Hi @Anderson_Lazzari

Welcome to our UiPath Forum! :slight_smile:

Please see my post above:

It contains a working example of this exact automation, together with an example API call :slight_smile:

4 Likes

Thanks for reply, but I want to automate outside of uipath using nodejs, so I want to know if have a way to send a post directly to the url https://account.uipath.com/usernamepassword/login using a request payload to use a chain like this
-> authorize…
-> login…

1 Like

Thank you very much. It worked!

4 Likes

Hey there,
I’m trying to authenticate by sending a GET and a POST to https://cloud.uipath.com/oauth/token,
however, as a response I get a HTML string, not the token in a json format.

This is the html string I geT: <!doctype html>You need to enable JavaScript to run this app.

I’m using Zapier to send the request, I tried adding “accept: application/json” and “request: application/json” in the headers but no success.
I appreciate any help.
Thanks!

3 Likes

Is there any way to get [Authorization code] via API without going to browser.

https://orchestrator.uipath.com/v2019/reference#section-getting-authorization-code

1 Like

Hi @Anik_Barua

Welcome to our UiPath Forum! :slight_smile:

Our team is working on making this entire process more straightforward. For the time being though, this is the workaround to authenticate that we have to stick to.

4 Likes

Hey guys,
I’m facing a problem in the generating refresh token step,
I followed the exact steps mentioned above till I got the link holding authorization code and state, and tried to make a post request for
https://account.uipath.com/oauth/token
but it responds with :
{
“error”: “invalid_grant”,
“error_description”: “Invalid authorization code”
}

could someone help me figure it out ?
Thanks.

Hi @sehemy

Could you post a screenshot of your post request (please cover sensitive information).

1 Like

Thanks a lot @loginerror
I gave it a trial today from a different network and it worked fine this step and generated the refresh tokens, don’t know what was the issue but apparently it works now.

2 Likes

What is the validity of the code challenge and code verifier that is being generated in the first step?

1 Like

Hi @shristigautam

Welcome to our UiPath Forum! :slight_smile:

The codes are irrelevant past the first generation. At you generate your first access_token, you will receive a refresh_token with it and that refresh_token will never expire.

To continue using the API, all you will need to do every 24 hours is to authenticate again with your refresh token. It is this part of the documentation:
https://orchestrator.uipath.com/v2019/reference#section-generating-access-token-and-id-token-using-the-refresh-token

4 Likes

Thank you for resolving my doubt! :slight_smile:

1 Like

Hi,
I am able to generate the access token and refresh token, and authorization is successful with the access token generated.

But when using refresh token to generate the Access token and token ID, i am getting below error
{
“error”: “access_denied”,
“error_description”: “Unauthorized”
}

could someone help me figure it out ? i am trying to use refresh token in my code to automate the authorization process.
Thanks.

1 Like

Hi @cj900

Welcome to our UiPath Forum! :slight_smile:

Could you show us your request? It would help in judging what is the issue here.

1 Like

URL : https://account.uipath.com/oauth/token

body:

{
“grant_type”: “refresh_token”,
“client_id”: “5v7PmPJL6FOGu6RB8I1Y4adLBhIwovQN”,
“refresh_token”: [refresh token]
}

There really isn’t much more to it… Really strange.

Could you try with another API testing app just to be sure?

1 Like

same issue with another API testing app.

Hi @loginerror ,
How can i get client id for above API call?

Thanks,
Venkat

Hi @venkateswara.rao

It is literally:
5v7PmPJL6FOGu6RB8I1Y4adLBhIwovQN

That one is not a variable, but a constant that should simply be take as is.

1 Like

Same thing here as @cj900. I’ve downloaded your CloudAPI access token UiPath file @loginerror and I was doing those things step by step on the browser.
The problem is not generating the tokens, refresh tokens, etc.

I think it will be really helpful if you guys:
-DELETE all the documentation files. I think the source of confusion is that there are multiple live documentation and each one with different methods, but then you need to go to multiple topics and you learn that some of these methods are not working anymore, and WITHIN those methods things changed as well.

I’m still confused on actually whether I need both the token (which kind of token) I need after going through so many.

So far I have:
ID token
Token
Access Token
Refresh Token -> I believe this is the final one I need?
Bearer Token

Or do I need BOTH the token AND the username (email) and password?

There are also multiple “username” aliases which makes bloody confusing.
So far on my account I was able to identify:

userEmail
Tenant
tenancyName
accountName
accountLogicalName
usernameOrEmailAddress
serviceInstanceName
serviceInstanceLogicalName
Administrator

I think if you guys could put a one video step by step Or a step by step on how to trigger the robot via API that would be great, because it involves the whole process from beginning to end (just like the training series) from generating tokens to making it work

1 Like