I’ve been struggling for hours, don’t know how to continue.
I’m trying to use app-only authentication, however EVERY request for a token is returned as “403 Forbidden: The server understood the request, but is refusing to fulfill it.”
I have doubled checked everything is correct, following the Twitter guide to the letter, yet still I always receive a 403.
My request looks like the below, and is being sent to: https://api.twitter.com/oauth2/token
$.ajax({
type: 'POST',
url: config[provider].auth_url,
beforeSend: function (request) {
request.setRequestHeader("Authorization", "Basic " + encodedToken);
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
},
data: 'grant_type=client_credential',
processData:false,
success: function (msg) {
callback(msg);
}, error: function(msg) {
alert(msg);
}
}
);
I have checked the token, it definitely is a BASE64 encoded value of: api_key:api_secret
What is going wrong?