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

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:

1 Like

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):

Hope this helps!

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