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 UiPath,
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.

3 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

5 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