Whoa there! The request token for this page is invalid. It may have already been used, or expired because it is too old. Please go back to the site or application that sent you here and try again; it was probably just a mistake."


#1

Hello.

We have a problem with twitter API, its giving error when we try to get authentication, its saying “Whoa there!
The request token for this page is invalid. It may have already been used, or expired because it is too old. Please go back to the site or application that sent you here and try again; it was probably just a mistake.”

Before few weeks it was working fine but not its not working… we did not change anything in our code… code is fine but few month we shift our hosting from USA based server to UK based server…

can anyone please help me ?


#2

Hello @episod.

today we re dong some changes in code, we change the library and now we are getting authentication but authentication , we are getting another error which is as below.

stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => Invalid or expired token [code] => 89 ) ) )

Can you please help me to solve this issue ?


#3

we are doing R&D and we got some other information and its below,

Ensure that your system’s timestamp is in sync with Twitter’s. We return the current time in the “Date” HTTP header with every request. If your request fails due to a timestamp mismatch, use this time to determine the delta between the system clock and our server clock and adjust your oauth_timestamps for subsequent requests accordingly.

Do you think this is a hosting time issue ? can anyone give me your feedback please?

Irshad Ahmad.


#4

It can definitely be a timestamp issue.

But I’d look at the code you have and compare it to the OAuth 1.0A documentation.

Are you passing an oauth_token to oauth/authorize? If you’re passing just a ?oauth_token=" parameter, it means you don’t have a request token, which is what you’d be passing to that method. That should lead you back to oauth/request_token and examining if you’re actually getting your token or not.

Make sure that the library you’re using uses the right paths. api.twitter.com/oauth/* for all operations, using HTTPS. Before sending a user to oauth/authorize, validate that you have a request token.


#5

we are using below code for authentication for twitter

$oauth = new TwitterOAuth(‘APIID’, ‘secreateid’);

$credentials = $oauth->get(“account/verify_credentials”);
$request_token = $oauth->getRequestToken();

$_SESSION[‘oauth_token’] = $request_token[‘oauth_token’];
$_SESSION[‘oauth_token_secret’] = $request_token[‘oauth_token_secret’];

$twtvalset=1;
$oauth_token = $_GET[‘oauth_token’];

if($oauth_token == ‘’)
{

$url = $oauth->getAuthorizeURL($request_token[‘oauth_token’]);

}

Please let me know if you help us