Getting error "{"errors":[{"code":32,"message":"Could not authenticate you."}]}" while making call to twitter user timeline API




I have tried to pull the usertime line tweets for multiple screen names.

For the first time I have called the twitter API for one screenName and I got the data in 16 pages.
For the second time again I have called the twitter API with a different screenName and I got the data in only 4 pages but the API is keeping on retrying for the page 5 which has no data and it is entering into the infinite loop.

I got the below below mentioned error messages, It’s not even stopping until I kill it manually.

{“errors”:[{“code”:32,“message”:“Could not authenticate you.”}]}
{“errors”:[{“message”:“Rate limit exceeded”,“code”:88}]}

Parameters: count=3200&screen_name=McDonaldsCorp&Since_ID=“SOME VALUE”&page="pageno"
Logic: timestamp=date +%s
nonce=date +%s%T | openssl base64 | sed -e s'/[+=/]//g'

oauth_signature=echo -n ${signature_base_string} | openssl dgst -sha1 -hmac ${signature_key} -binary | openssl base64 | sed -e s'/+/%2B/' -e s'/\//%2F/' -e s'/=/%3D/'
header=“Authorization: OAuth oauth_consumer_key=”${consumer_key}”, oauth_nonce="${nonce}", oauth_signature="${oauth_signature}", oauth_signature_method=“HMAC-SHA1”, oauth_timestamp="${timestamp}", oauth_token="${oauth_token}", oauth_version=“1.0"”

curl --get “” --data “screen_name=${screen_name}&page=${pageNo}&since_id=${since_id}” --header “Content-Type: application/x-www-form-urlencoded” --header “${header}” > ${screen_name}_$pageNo.json

How can I stop the API call if there is no data ?



It’s likely an error in whatever library / code you’re using to make calls - maximum count in parameters should be 200, not 3200 - page parameter does not exist in timelines, only since_id and max_id - have a look at &


Thanks for your suggestion.

It’s is irrelevant to the error. You can see the page parameter in the example while generating OAuth Signature in twitter application.

My issue is If there is no data for the screen_name then it was retrying the twitter API until I kill it manually.
I would like to stop the API if there is no data.


Would you please share the complete code you are using?