I am trying to recieve an access token from the following URL:
https://api.bufferapp.com/1/oauth2/token.json
The following code is my POST request, I seem to have everything included according to the Buffer API documentation and the OAuth 2 rules:
$.ajax({
type: 'POST',
url: 'https://api.bufferapp.com/1/oauth2/token.json',
headers: {
'Accept': 'application/json',
'Content-Type': "application/x-www-form-urlencoded; charset=UTF-8",
},
data: {
client_id: "{MY_CLIENT_ID}",
client_secret: "{MY_CLIENT_SECRET}",
redirect_uri: "http://localhost/testexample",
code: "{MY_AUTH_CODE}",
grant_type: "authorization_code"
},
success: function(response) {
console.log(response);
},
error: function(response) {
console.log(response);
},
dataType: "jsonp"
});
When I execute the code, I recieve the error: net::ERR_ABORTED, and the URL returns: {"error":"invalid_request","error_description":"Invalid grant_type parameter or parameter missing"}
What am I doing wrong?
Thank you for your time.
