Sign in with Twitter always requires authorization at login?


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);


If you want to use Sign in with Twitter you have to make sure “Allow this application to be used to Sign in with Twitter?” is enabled in your application settings and you have to use oauth/authenticate instead of oauth/authorize.


Thanks abraham, this solved my problem perfectly. Love your work.