Http request - Get access token

Hey guys :slight_smile:

Im having abit of problems getting a access token via Http request in UiPath.

I can get the request to work in Postman. In postman im using a OAuth2 to get the token.

image

I made a dictionary containing the below combinations in uipath that i convert to json using assign.

grant_type = client_credentials
client_id = client id
client_secret = client secret
scope = “”

When i try to pass the access info into the body of http request (as json string), i get error code 400.

Endpoint is the url for the token.

Hope theres a clever person who has the answer :slight_smile:

Thanks in advance!

Found the answer myself. For those interested, the variables to get to token needs to passed as parameters in the http request.

/cheers

2 Likes

Hi Bjorn,

I’m trying to get an authentication token for O365 using the Http Request activity in UiPath, and I thought that this post might be relevant.

In using OAuth2 to get the token, what did you pass in the Properties panel of HttpClient activity?

Thanks in advance!

Cheers,
Shearer Tan

Hi Bjorn,
Are you able to provide a screenshot of your parameters in the HTTP Request activity?
I’ve fallen into the same scenario as yourself.
TIA!

Hi Guys,

Managed to get it to work with the following setup in the Parameters properties:


image

Additionally, what my issue was I was missing the Authorisation in the Header:
image

Hope this helps anyone landing in the same spot. :upside_down_face:

2 Likes

Hi team,
I have done a API request in Postman that contains some body and Authorization using OAuth2.
I need to setup the same in UiPath using a HTTP request.
For generating OAuth2 Token there are the values that we are passing in Postman:
Header Prefix = Bearer
Grant Type : Client Credentials
Access Token URL = xxxxxxxxxx
Client ID = xxxxxxxx
Client Secret = xxxxxxxxx
Client Authentication = Send as Basic Auth Header

I need to generate the same token in UiPath. can u help me in this

@Bjorn @cojekz @shearer.tan

Hi Jishnu,

Have you installed the following package in UiPath to enable you to do API calls to obtain your token?
image

Once installed you’ll have the following menu available to you and you then you can enter the information you have necessary to make the request to obtain the token. See screenshot example below:

Headers collection:

Parameters collection (may differ to yours but follows same principle):
image

Hope this helps!

1 Like

Hi @cojekz ,

i dont have the token to pass to headers in authorization. i need to get that. for that i am not able to do the API call

Hello Jishnu,
Here is playlist with 12 videos with HTTP Request, in some of this videos I do also Oauth2 to get the Token (maybe this will help you):

Thanks,
Cristian Negulescu

1 Like

Hey Guys, I’m facing a problem between postman and uitpah studio pro.

On postman I have this information

How I can transfer this information to uipath - headers ?

I was thinking on the following but that is not working

Can you please help here?

Thanks

Did you got an fix for the same?

Please check here

Http request issue - Studio pro / Postman - Help / Activities - UiPath Community Forum

I need to pass a variable extracted with Bearer key, So please let me know how to do the same.

I tried the same but no luck.

image

Hello Anuj,
Be careful on SPACE instead of “Bearer” you need "Bearer " check the last character on the string should be space.
Thanks,
Cristian