Fatal error: Uncaught exception with message 'Invalid request token'


#1

Hello Community;
Everything was working absolutely fine with the script until some of the users reported this issue while authorization:

Fatal error: Uncaught exception 
'Abraham\TwitterOAuth\TwitterOAuthException' with message 'Invalid 
request token' in \twitteroauth\src\TwitterOAuth.php:141 Stack trace: #0
 \twitter_callback.php(41): 
Abraham\TwitterOAuth\TwitterOAuth->oauth('oauth/access_to...', Array)
 #1 {main} thrown in \twitteroauth\src\TwitterOAuth.php on line 141

In twitter_callback.php line 41:

$access_token = $connection->oauth("oauth/access_token", array("oauth_verifier" => $_REQUEST['oauth_verifier']));

I noticed that the main library have been updated: https://github.com/abraham/twitteroauth , so I downloaded them and applied them to the website and still the same issue, only “TwitterOAuth.php on line 141” changed it was “TwitterOAuth.php on line 221”.

The issue happened to all my working websites at the same time, and no application configuration edits were made.

Thanks for your time.


#2

Original TwitterOAuth issue here. Based on the discussion it seems like the cause was a change on Twitter’s side so I directed @i4344 to post here.

All was working fine a few days ago then suddenly all of that stopped working (Demo, localhost, and many customers reported it me). The reports started today and all of these are in different servers.
Demo in Germany, localhost in Egypt, customers mostly hosted in USA.


#3

I reviewed your documents here: https://twitteroauth.com and hoping that rebuilding the callback.php file will help and it did. :slight_smile:
I found the issue:
I was using:

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);

It should be:

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $request_token['oauth_token'], $request_token['oauth_token_secret']);

Thanks for your time and support. :slight_smile: