Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

HttpClientRequest POST method with parameters

Avatar

Avatar
Level 1
jamesx9778150
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
jamesx9778150
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
View profile
jamesx9778150
Level 1

07-02-2019

Hi all,

I'm using a Javascript activity in a workflow to do a REST API POST call to obtain a taken.

Code is as follows:

var requestUrlAPI = 'https://login.microsoftonline.com/{tenant}/oauth2/token'

var bodyStr = 'grant_type=client_credentials&client_id={clientID}&client_secret={clientSecret}';

var http = new HttpClientRequest(requestUrlAPI);

http.method="POST";

http.header["Content-Type"]= "application/x-www-form-urlencoded";

http.body = bodyStr;

http.execute();

However, I'm getting an error regarding invalid client and client secret. Though it does seem to recognize "grant_type". I've tested the same values in Soap UI with success. Can anyone help deciphering what may be happening here?

Error Code:

HTTP header 'WWW-Authenticate' used for proxy authentication not found.

{"error":"invalid_client","error_description":"AADSTS7000215: Invalid client secret is provided.\u000d\u000aTrace ID: 3f12551b-15dc-4c72-964d-c3425f7a2500\u000d\u000aCorrelation ID: fde89e79-a6b4-406e-8387-40480a6a8edd\u000d\u000aTimestamp: 2019-02-07 20:17:02Z","error_codes":[7000215],"timestamp":"2019-02-07 20:17:02Z","trace_id":"3f12551b-15dc-4c72-964d-c3425f7a2500","correlation_id":"fde89e79-a6b4-406e-8387-40480a6a8edd"}

Appreciate any help!

Accepted Solutions (0)

Answers (0)