Errors message: Could not authenticate you (code:32)


#1

I try to use users/search.json and i received this error code:
"{“errors”:[{“message”:“Could not authenticate you”,“code”:32}]}"

any ideas how to fix this?

This is my code:
$url = “https://api.twitter.com/1.1/users/search.json?q=twitter”;

$consumer_key		= "XYZ";
$oauth_access_token	= "XYZ";
$consumer_secret	= "XYZ";
$oauth_access_token_secret = "XYZ";

$oauth = array( 'oauth_consumer_key' => $consumer_key,
		'oauth_nonce' => time(),
		'oauth_signature_method' => 'HMAC-SHA1',
		'oauth_token' => $oauth_access_token,
		'oauth_timestamp' => time(),
		'oauth_version' => '1.0');


/*-------Create OAuth signature -----------*/
$base_info = buildBaseString($url, 'GET', $oauth);
$composite_key = rawurlencode($consumer_secret) . '&' . rawurlencode($oauth_access_token_secret);
$oauth_signature = base64_encode(hash_hmac('sha1', $base_info, $composite_key, true));
$oauth['oauth_signature'] = $oauth_signature;


/*-------Set up HTTP header --------*/
$header = array(buildAuthorizationHeader($oauth), 'Expect:');
print_r($header);
$options = array( CURLOPT_HTTPHEADER => $header,
		CURLOPT_HEADER => false,
		CURLOPT_URL => $url,
		CURLOPT_RETURNTRANSFER => true,
		CURLOPT_SSL_VERIFYPEER => false);

$feed = curl_init();
curl_setopt_array($feed, $options);
$json = curl_exec($feed);
curl_close($feed);
var_dump($json);

#2

I recommend using an OAuth library. In this case it looks like you’re not building you signature base string correctly – you need to sort the query parameters that are part of your URL. See [node:3036].


#3

30 year coder, but trying to move my apps (which run from my computer only - relatively modest data acquisition) to OAuth-authenticated REST API calls, and I am experiencing

{“errors”:[{“message”:“Could not authenticate you”,“code”:32}]}

on all of my GET and PUT attempted requests too. When I first tested the code, I did see a valid JSON response on a couple of requests (wish I had noted which ones - I didn’t expect to be banging my head against the wall for 2 days).

I have tried re-creating apps and OAuth parameters, etc. I know a lot of people have encountered this suddenly but there does not seem to be a definitive answer. Has ANYONE figured out what causes

{“errors”:[{“message”:“Could not authenticate you”,“code”:32}]}

Any help would be welcome. I implemented the original URL-based REST calls on an unorthodox platform - in VBA (I know, I know - but it is very useful for the use case), have debugged extensively, am pretty familiar and comfortable with the encoding and hashing steps, and the key-pair authentication concepts… but know that OAuth has so many “gotchas” that rolling my own is not optimum. Just the same, this is what I need to make work.

I would be very happy to share ALL of the tokens (I can change them after I solve this) or any debugging to expose each step. Thanks in advance to whomever is able to help!


#4

There appears to be no PHP API library for 1.1


#5

I can’t send a direct tweet to my followers it deny.


#6

Has anyone found a solution to this yet? If not, then this may help?

I’ve noticed this happening with calls that require parameters. For instance:
https://api.twitter.com/1.1/statuses/user_timeline.json, works
https://api.twitter.com/1.1/blocks/list.json, works
https://api.twitter.com/1.1/blocks/list.json?skip_status=true, gives me that error, “Could not authenticate you”


#7

That tends to indicate something is amiss with your OAuth signing process – usually it means that your parameters aren’t being properly sorted into the signature base string before signing.


#8

+1 same problem here


#9

Same error. https://api.twitter.com/1.1/statuses/user_timeline.json works but https://api.twitter.com/1.1/search/tweets.json doesn’t


#10

Same error. https://api.twitter.com/1.1/statuses/update.json works but https://api.twitter.com/1.1/statuses/user_timeline.json doesn’t in android app. Both are working fine in iPhone.


#11

I have the same problem her now. I’m using AS3, AIR on Flash Everything is going fine, the program even tells me the post was successfull - but it wasn’t because I get this.
{“errors”:[{“message”:“Could not authenticate you”,“code”:32}]}

It would be real nice if that error message would actually also say WHY it wasn’t authenticating …

This, from the api errir code table is obviously not right…
32 Could not authenticate you Your call could not be completed as dialed.

see here https://dev.twitter.com/docs/error-codes-responses

Here are the responses I’m getting from a trace so far.
Obviously with the keys changed to xxxxx’s

The numbers are line numbers.

1516:Here we are calling Auth
1639PinPoint Xtra puts ShanghaiTimes here: http://tinyurl.com/9qteqfu
1640:Sending Tweet via Tweetr.as
1 {“errors”:[{“message”:“Could not authenticate you”,“code”:32}]}
Event Complete:
Username: ShanghaiTimes
User Id: 16xxxxxxxx
OAuth Token: 1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxQ
OAuth Token Secret: oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxgw

I keep trying, hopefully next week will see it ok


#12

i got the cURL string using OAuth tool
curl --get ‘https://api.twitter.com/1.1/followers/list.json’ --data ‘cursor=-1&include_user_entities=false&screen_name=sitestreams&skip_status=true’ --header ‘Authorization: OAuth oauth_consumer_key=“XXXXXX”, oauth_nonce=“XXXXXX”, oauth_signature=“XXXXXX”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“XXXXXX”, oauth_token=“XXXXXX”, oauth_version=“1.0”’ --verbose

and my php code is

$url = trim(‘https://api.twitter.com/1.1/followers/list.json’);
$postArr = array(‘cursor’=>’-1’,‘screen_name’=>‘tokalpeshdp’,‘skip_status’=>‘true’,‘include_user_entities’=>‘false’);
$othArr = array(‘Authorization: OAuth oauth_consumer_key=“XXXXX”,oauth_nonce=“XXXXX”,oauth_signature=“XXXXX”, oauth_signature_method=“HMAC-SHA1”,oauth_timestamp=“XXXXX”,oauth_token=“XXXXX”,oauth_version=“1.0”’);
$ch = curl_init($url);
if ($ch === FALSE){
throw new Exception(‘failed to initialize’);
exit;
}
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,$postArr);
curl_setopt($ch, CURLOPT_HTTPHEADER,$othArr);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT,2000);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
$result = curl_exec($ch);
if(curl_error($ch))
{
echo "Error: >> ".curl_error($ch);
exit;
}

echo "Result: >> ".$result; 

AND I GOT FOLLOWING RESULT ¬

{“errors”:[{“message”:“Could not authenticate you”,“code”:32}]}Result: >> 1

so what is the wrong with my code.


#13

Are you generating your signature and timestamp at runtime while setting up this code? The signatures and timestamps generated by the OAuth tool will not be valid for more than a few minutes.


#14

Login with twitter was working fine with version 1.1, until recently a couple of days back, i see this response. {“errors”:[{“message”:“Could not authenticate you”,“code”:32}]}.
What could be the reason??
I am using the updated version of Abraham Williams library.


#15

me too… stuck with this …did you found any solution?


#16

any solution, me too stuck with this?


#17

code:32


#18

same problem here. using python twitter tools from http://mike.verdone.ca/twitter/


#19

same problem…
did you find a solution?


#20

I am generating the signature and timestamp at the runtime., still I am getting the same error. What could be the solution ?