I have created a login system for my website which allows users to sign in with Twitter.
On the Twitter Apps control panel I have
"Sign in with Twitter" set to “Yes”.
The login is always successful, and I have been using it to verify the identity of users without a problem and get their username and profile picture.
However, whenever anyone logs in it brings up the Authorization page, even if they have given authorization before. What am I doing wrong? Here is the relevant code from my login script.
I assume the callback script is irrelevant to this issue as it occurs after login.
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
$request_token = $connection->oauth('oauth/request_token', array('oauth_callback' => OAUTH_CALLBACK));
if( $request_token)
{
$token = $request_token['oauth_token'];
$_SESSION['twitter'] = array();
$_SESSION['twitter']['request_token'] = $token ;
$_SESSION['twitter']['request_token_secret'] = $request_token['oauth_token_secret'];
$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
header('Location: ' . $url);
}