Bad Authentication data [code] => 215 at Abraham twitteroauth

9GagCloneScript
@9GagCloneScript 9Gag Clone Script

I have been using Abraham's TwitterOAuth for months and it was working ok.
I don't really know when exactly this problem happened but a few days ago I discovered Twitter Connect in my script isn't working.

  1. /* If method is set change API call made. Test is called by default. */
  2. $user_info = $connection->get('account/verify_credentials');
  3.  
  4.     if(isset($user_info->error)){  
  5.         // Something's wrong, go back to square 1  
  6.         header('Location: twitter_login.php'); 
  7.     } else { 
  8.         // Let's find the user by its ID  
  9.  
  10.       $query = "SELECT * FROM members WHERE username ='" .$user_info->screen_name ."'";  
  11.        $result = $conn->execute($query);
  12.         // If not, let's add it to the database  
  13. }

Actually this code results in empty search. So I echoed $user_info->screen_name and found it always returns empty result.
I used

  1. print_r($user_info);

And that was the output :

  1. stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => Bad Authentication data [code] => 215 ) ) ) 

Any help?

1 year 17 weeks ago

Replies

9GagCloneScript
@9GagCloneScript 9Gag Clone Script

Problem is partially fixed.
Since I only needs screen_name value to check the database, I tried to echo $access_token in callback.php file.
I found that screen_name value exists. That solved my problem by moving the rest of my code to callback.php
I hope this may help anyone.
Best Regards

1 year 17 weeks ago
champramentio
@champramentio Champ Ramentio

The API ver 1.0 is deprecated, use 1.1 instead

44 weeks 1 day ago