How to get bearer/access token using grant type - Authorization Code With PCKE using HTTP Request

Hi All,

I tried to get the bearer/access token using grant type - Authorization Code With PCKE with HTTP Request activity by passing the parameters as below

Request URL : Access token url
Method : POST
Body - “{
‘grant_type’: ‘authorization_code’,
‘client_id’: ‘’,
‘redirect_uri’: ‘’,
‘code_challenge_method’: ‘SHA-256’
}”

Deserialized the Body - Json string into Json object

Header - Content-Type — “application/json”

Referred the UiPath documentation and Tried some workarounds by changing the Content-Type — “application/x-www-form-urlencoded” but no luck.

Any help would be appreciated if anyone have come across getting the bearer token using grant type - Authorization Code With PCKE.

Thank you.

@Karuna

For this method…we should not use body…these should be in the url parameters

Please change accordingly

Cheers

@Anil_G
Hi Anil,
I tried passing the parameters in url as below

Headers : Content-Type : “application/x-www-form-urlencoded”

Request url : “https://Access Token URL?grant_type=authorization_code&redirect_uri=”“&client_id=”“&code_challenge_method=SHA-256”

Request Method : Post

Tried some workarouns but but no luck and getting this --{“error”:“invalid_grant”,“error_description”:“The authorization code is invalid or has expired.”}

What could be the wrong here?