Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2021
48
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var payload = '{"grant_type":"client_credentials",';
  2. payload += '"client_id":"XXXXX",';
  3. payload += '"client_secret":"XXXXXXX",';
  4. payload += '"scope":null,';
  5. payload += '"account_id":"XXXXXXXXXX"}';
  6. var url = "https://mcvwf-nkxrzjq7703k4qnp23fgt1.auth.marketingcloudapis.com/v2/token";
  7. var contentType = 'application/json';
  8. try {
  9. /* perform HTTP Post request to get a new OAuth 2.0 access token */
  10. var accessTokenResult = HTTP.Post(url, contentType, payload);
  11. var tokenObj = Platform.Function.ParseJSON(accessTokenResult["Response"][0]);
  12. var accessToken = tokenObj.access_token;
  13. Write("<BR>OAuth 2.0 Access Token: " + accessToken);
  14. } catch(e) {
  15. Write('<h1>third call</h1></br>');
  16. Write('url: ' + url + '</br>');
  17. Write('payload: ' + Stringify(payload) + '</br>');
  18. Write(Stringify(e));
  19. Write('</br>');
  20. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement