Bad authentication data while retrieving followers list using GET followers/ids of REST API v1.1


#1

https://api.twitter.com/1.1/followers/list.json?cursor=-1&screen_name=Subhojit_Sen&skip_status=true&include_user_entities=false

This returns {“errors”:[{“message”:“Bad Authentication data”,“code”:215}]}

The code I am using gets the user to authorize the app and it returns the screen name too ! But it shows the error code “215” while retrieving the followers list.

Tried so many solutions but cant catch the loop-hole where the problem is lying actualyy !

Can anyone help me out in solving this !

Thanks in Advance !

Subhojit !


#2

Maybe you’re having an issue with sorting parameers in OAuth signature base string? Here’s what the signature base string should look like for a request like this:

GET&https%3A%2F%2Fapi.twitter.com%2F1.1%2Ffollowers%2Flist.json&cursor%3D-1%26include_user_entities%3Dfalse%26oauth_consumer_key%3D5aA6oofBOFAwN4tfmEYWjg%26oauth_nonce%3DqGX0Hv4K2nhY4vYIbne6SEVtWJlJ8PKThBKxKaJxkoI%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1371134854%26oauth_token%3D119476949-oYGCs2M5duG5QalbOAK2YUZh8zG3ur7DPYo5qIFN%26oauth_version%3D1.0%26screen_name%3DSubhojit_Sen%26skip_status%3Dtrue

#3

Thank you for that guideline !

But when I tried to execute the base string I get by [ htmlspecialchars_decode & decodeURIComponent] it returns null value !

Also I understood the cURL command will actually execute the request

I am trying to build a code to translate the curl command to a php one !

like this ->

But I am not undestanding how to pass the following values in the code after authorizing the app !

oauth_consumer_key
oauth_signature
oauth_timestamp
oauth_nonce

Can you please help me out !

Thanks !


#4
<?php error_reporting(-1); ini_set('display_errors', true); $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: OAuth oauth_consumer_key="uFgcKiqLTdv12cAsz5SFQ", oauth_nonce="358ba9d308c4ce3ff640b7f791dc7944", oauth_signature="%2FJf57UZNUaWxMgpsEJpiwBSo8w8%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1371272211", oauth_token="918476185-887ZJ481Prr4LKmSwdjq3gQBzfDRTqHfOKbSKygT", oauth_version="1.0"')); curl_setopt($ch, CURLOPT_CAINFO, 'cacert.pem'); curl_setopt($ch, CURLOPT_VERIFYPEER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPGET, 1); curl_setopt($ch, CURLOPT_URL, 'https://api.twitter.com/1.1/followers/list.json?cursor=-1&screen_name=Subhojit_Sen&skip_status=true&include_user_entities=false '); $page = curl_exec($ch); curl_close($ch); //$response = curl_exec($ch); print_r($page); ?>

#5
<?php error_reporting(-1); ini_set('display_errors', true); $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: OAuth oauth_consumer_key="uFgcKiqLTdv12cAsz5SFQ", oauth_nonce="358ba9d308c4ce3ff640b7f791dc7944", oauth_signature="%2FJf57UZNUaWxMgpsEJpiwBSo8w8%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1371272211", oauth_token="918476185-887ZJ481Prr4LKmSwdjq3gQBzfDRTqHfOKbSKygT", oauth_version="1.0"')); curl_setopt($ch, CURLOPT_CAINFO, 'cacert.pem'); curl_setopt($ch, CURLOPT_VERIFYPEER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPGET, 1); curl_setopt($ch, CURLOPT_URL, 'https://api.twitter.com/1.1/followers/list.json?cursor=-1&screen_name=Subhojit_Sen&skip_status=true&include_user_entities=false '); $page = curl_exec($ch); curl_close($ch); //$response = curl_exec($ch); print_r($page); ?>