Problem with oAuth authentication for users/search


#1

I’m trying to call http://api.twitter.com/1/users/search.json?q=Mike Potter with my own application and I am getting a 401 error - needs authentication.

I also tried it using the Twitter console (https://dev.twitter.com/console) and I’m getting the same error (even though I have authenticated with the console).

Is this a problem with Twitter, or with my app and the console?

I’m using the tmhOauth library BTW.

Thanks,

Mike


#2

When you’re searching via the console or your application, do you know how the space character is being handled? It may be causing authentication to fail if it is not encoded properly. The space should be sent as a %20 on the querystring and a %2520 in the signature base string.


#3

$username = 'username email ';
$password = ‘password’;
$message = ‘hi123’;

// Set your username and password here
$user = $username;

    $ch = curl_init("https://twitter.com/statuses/user_timeline.xml");
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch,CURLOPT_TIMEOUT, 30);
    curl_setopt($ch,CURLOPT_USERPWD,$user . ":" . $password);
    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
    curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
    $result=curl_exec ($ch);
    $data = strstr($result, '<?');

    $xml = new SimpleXMLElement($data);

i use this code for tweet massage to my profile.
at that time i got error no 35, and display ‘Basic authentication is not supported’

can u please tell how this fix?

thanxs.


#4

You cannot authenticate with your username and password any longer – that method of authentication has been deprecated for some time (along with the URL you’re trying to access). You want to leverage OAuth – I recommend checking out the tmhOAuth library: https://github.com/themattharris/tmhOAuth