var body = {
'grant_type':'authorization_code',
'client_id':'4e5ea385244bf6918aa5d7180dbd0b8b',
'redirect_uri':'https://mcz90ql1wssr79j1bstmb5qj69h8.pub.sfmc-content.com/tsc2mv1pbjd',
'code':code
};
var payload = toFormEncoded(body);
function toFormEncoded(obj) {
var newArr = [];
if (typeof(obj)=='object') {
for (var i in obj) {
var encodedKey = encodeURIComponent(i);
var encodedValue = encodeURIComponent(obj[i]);
newArr.push(encodedKey + "=" + encodedValue);
}
return newArr.join("&");
}
}