I follow this code and I use thid library http://hayageek.com/login-with-twitter/
Log in works but I think that the oauth token that the program generates are bad. This is my problem and I don't know how I can resolve:
$connection = new TwitterOAuth($CONSUMER_KEY, $CONSUMER_SECRET);
$request_token = $connection->getRequestToken($OAUTH_CALLBACK); //get Request Token
if( $request_token)
{
echo print_r($request_token);
$token = $request_token['oauth_token'];
$_SESSION['oauth_token'] = $token = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
switch ($connection->http_code)
{
case 200:
$url = $connection->getAuthorizeURL($token);
//redirect to Twitter .
header('Location: ' . $url);
break;
default:
echo "Coonection with twitter Failed";
break;
}
}
else //error receiving request token
{
echo "Error Receiving Request Token";
}
and after log in the page the callback page do this:
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
/
$content = $connection->get ( "account/verify_credentials" );
Now I obtain "Invalid and expiried token". Anyone can help me?