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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

The 4th edition of the Campaign Community Lens newsletter is out now!

HttpClientRequest POST method with parameters


Level 2

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 = '{tenant}/oauth2/token'

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

var http = new HttpClientRequest(requestUrlAPI);


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

http.body = bodyStr;


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!

2 Replies


Level 1
I am getting the same issue when calling an oauth endpoint. Can someone help?