Application-only authentication oauth2/token endpoint does not exist?


#1

I’m trying to post to https://api.twitter.com/oauth2/token to get the application bearer token and I’m getting “Sorry, that page doesn’t exist!”. Is it not working or something I’m doing? This code worked yesterday, btw.

$bearer = $cfg['twitter']['consumer_key'] . ':' . $cfg['twitter']['consumer_secret'];
$bearer = base64_encode($bearer);

$ci = curl_init();
/* Curl settings */
curl_setopt($ci, CURLOPT_USERAGENT, "My User Agent 1.0");
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ci, CURLOPT_TIMEOUT, 30);
curl_setopt($ci, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ci, CURLOPT_HTTPHEADER, array('Authorization: Basic ' . $bearer));
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ci, CURLOPT_HEADER, FALSE);

$postfields = array("grant_type"=>"client_credentials");
curl_setopt($ci, CURLOPT_POST, TRUE);
if (!empty($postfields)) {
	curl_setopt($ci, CURLOPT_POSTFIELDS, $postfields);
}


curl_setopt($ci, CURLOPT_URL, "https://api.twitter.com/oauth2/token");
$response = curl_exec($ci);
$http_code = curl_getinfo($ci, CURLINFO_HTTP_CODE);
$http_info = curl_getinfo($ci);
curl_close ($ci);

echo $response;

#2

Thanks for the report. Looking into it.


#3

We should have this resolved as soon as possible.


#4

We, at TPVision, are also facing an issue with this - that is the URI for Application Authentication does not seem to exist.


#5

This is in progress toward resolution. You may notice it working intermittently now rather than not at all. When the resolution is complete, it will again be fully functional. Thanks!