401 Error When I request REST API


#1

Hello Everyone,
I try to do some work with twitter this weekend.
Everything is O.K at 3-legged OAuth with PHP.
But, when I request “http://api.twitter.com/1.1/statuses/mentions_timeline.json”, twitter server seems doesn’t like me ;<
It throws me a error message :

string(209) "HTTP/1.1 401 Unauthorized
Content-Type: application/json; charset=utf-8
Content-Length: 63
Date: Sun, 30 Sep 2012 09:24:24 UTC
Server: tfe

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

And this is my curl header in PHP:

'oauth_callback' => self::curPageURL(),
'oauth_consumer_key' => $this->app_key,
'oauth_nonce' => crc32(time()),
'oauth_signature_method' => 'HMAC-SHA1',
'oauth_timestamp' => time(),
'oauth_token' => $oauth_token,
'oauth_version' => '1.0',

key =  urlencode($this->app_secret).'&'.urlencode($this->access_token_secret);
$base_string = "GET&".urlencode($query).'&'.urlencode(http_build_query($params));
$signature = base64_encode(hash_hmac("sha1", $base_string, $key, true));
$params['oauth_signature'] = urlencode($signature);

Maybe I lose something? But, the request of “'http://api.twitter.com/1/account/verify_credentials.json” work fine, it works fine only.
After some research of that, I cant find any useful information, cause it’s API 1.1 ?
Any help?


#2

Welcome to the club. 1.1 API calls all seam to fail except authentication. I’m having same issue with users/show usage giving the exact same response. For now it looks like we should continue with version 1 API calls until the fix this garbage. I’ve spent 6 hours working on this and could not find a solution; always same response as you received.