Not getting Access token

Hi,
I am not getting the response for the post method of HTTP request.I am getting the error like this.
{“error”:“invalid_request”,“error_description”:“AADSTS900144: The request body must contain the following parameter: ‘grant_type’.\r\nTrace ID: 3c1d7b99-8382-46a8-a02e-97a62f13bb00\r\nCorrelation ID: 68b8de0f-aaee-4ba5-8d73-20d74bd6d158\r\nTimestamp: 2019-11-29 06:08:07Z”,“error_codes”:[900144],“timestamp”:“2019-11-29 06:08:07Z”,“trace_id”:“3c1d7b99-8382-46a8-a02e-97a62f13bb00”,“correlation_id”:“68b8de0f-aaee-4ba5-8d73-20d74bd6d158”,“error_uri”:“https://login.microsoftonline.com/error?code=900144”}

Regards,
Surya

@Surya_123

What is the HTTP request that you are making? URL, Headers, Body?

1 Like

I hope you are just trying to pass the params which you have not the params as per the documentation of the web service request. Can you check the documentation for what are all the parameters that needs to be passed and everything is as per the method requires @Surya_123

yeah HTTP request using post method. I am using host and content type in headers and client id,grant-type,scope in body.The same thing i tried in post man it is working.But in uipath i am getting the error which i mentioned in my previous post
Regards
Surya

@mjdeale I gave all the parameters which i tried in the postman. It is working in postman,but i am not getting in the uipath. I am passing grant_type as client credentials in post man,but the same thing is not working in uipath
Regards,
Surya

@HareeshMR I gave all the parameters which i tried in the postman. It is working in postman,but i am not getting in the uipath. I am passing grant_type as client credentials in post man,but the same thing is not working in uipath
Regards,
Surya

@Surya_123

Please check the bodyformat properties is application/json
if not changed and checked it once

@amaresan yes the body format is application/json. I think the problem is with grant type in body

@Surya_123

It would be helpful for me to see the exact code you are using. Maybe some screen shots?

Hi @Surya_123,

I had a similar issue and in my case the problem was in given body. Try following method. Following are my property configuration of HTTP Request Activity.

Input —> Accept Format = JSON
Input —> Method = POST (appropriate method)

Options —> Body = Refer below
Options —> BodyFormat = application/json

My JSON was something like this.

{
“grant_type”:“password”,
“scope”:"*",
“client_id”:“abcd”,
“client_secret”:“xyz”,
“username”:“john_doe”,
“password”:“j0hnD0e@123”
}

If you replace double quotes with single quotes and provide above string in one line you might receive invalid JSON error. So you need to keep the double quote as it is like following and provide it to the Body property.

{
““grant_type””:"“password”",
““scope””:""*"",
““client_id””:"“abcd”",
““client_secret””:"“xyz”",
““username””:"“john_doe”",
““password””:"“j0hnD0e@123"”
}

Note: You need to give this in a single line in Body property.

image

Now you should be able to get the response. Hope it helps.

any luck on this issue ??