API 1.1 error code 32


#1

Hello, I’m using the tmhOauth library for authenticated requests and when I use the API 1.1
I receve this “message”:“Could not authenticate you”,“code”:32. I tried different type of requests, but without results.
If I use the API 1.0 all goes good. I had googled around but I’ve found anything specific about my problem.
Someone had the same issue, or some solutions?

Here an example:

$oAuth = new tmhOAuth(array("consumer_key" =>$consumerKey, 
                                             "consumer_secret"=>$consumerSecret, 
                                             "user_token" => $accessToken, 
                                             "user_token_secret" =>$accessTokenSecret,
                                             'curl_ssl_verifypeer'   => false));
$socialid = an id;
$url ="https://api.twitter.com/1.1/users/lookup.json";

$parameters = array('user_id' => $socialId, 'include_entities' => true);

$oAuth->request('GET', $url, $parameters);
        
$code = $oAuth->response['code'];
if ( $code == 200)
    echo $oAuth->response['response'];
else{
     echo "Request turn bad: Error ".$code;
     echo var_dump($oAuth->response['error'])."</br>";
     echo var_dump($oAuth->response['raw'])."</br>";
}

#2

Are you using commas in your request? Make sure they’re encoded according to the HTTP spec – you should send %2C in a POST body or querystring to represent commas.


#3

No commas, and the library seems to encode the url
This is the response:

string(45) "https://api.twitter.com/1.1/users/lookup.json"
Request turn bad: Error 401
string(0) ""
string(209) “HTTP/1.1 401 Unauthorized Content-Type: application/json; charset=utf-8 Content-Length: 63 Date: Tue, 27 Nov 2012 10:42:46 UTC Server: tfe {“errors”:[{“message”:“Could not authenticate you”,“code”:32}]}”


#4

Hello! Thank you for the answer, I don’t use any commas, and the library should handle the encoding itself…