Skip to main content

FreshPlugs - how to send oauth token?

  • February 23, 2015
  • 1 reply
  • 24 views

When using Freshdesk.Widget request method, with auth_type set to "OAuth", I'm able to retrieve access token from my REST service. Now, in order to get other data, I need to send this token as OAuth-Token in request header.


Does nayone know how this can be achieved?

This topic has been closed for replies.

1 reply

  • Author
  • Apprentice
  • February 28, 2015

In case someone else need this, here is how to send oauth token using request method:


    var req_body = {
rest_url: 'rest/v10/Accounts?max_num=3',
method: 'post',
content_type: '',
on_success: function(data) {
console.log(data.responseJSON);
},
on_failure: function(data) {
console.log(data.responseJSON);
}
};
req_body["custom_auth_header[OAuth-Token]"] = accessToken;
proxy.request(req_body);
}