I am trying to authenticate user using OAuth and retrieve the user data. When the user is not signed into twitter the authentication works and I am able to get the user details. But if the user is already signed in on twitter I am getting this error message '403 Forbidden: The server understood the request, but is refusing to fulfill it.' . In some posts they said to make all the requests through https instead of http. That I have done. I have downloaded the code for authentication from 'http://net.tutsplus.com/tutorials/php/how-to-authenticate-users-with-twitter-oauth/' . Please help.
$twitterOauthObj = new TwitterOAuth($oauth_consumer_key, $oauth_consumer_secret);
if(!isset($_GET['oauth_token'])){
$requestTokenArray = $twitterOauthObj->getRequestToken($callback_url);
$requestToken = $requestTokenArray['oauth_token'];
$tokenSecret = $requestTokenArray['oauth_token_secret'];
$authorizeUrl = $twitterOauthObj->getAuthorizeURL($requestToken);
$response = $twitterOauthObj->oAuthRequest($authorizeUrl, 'GET', $requestTokenArray);
print_r($response);
} else{
$oauthToken = $_GET['oauth_token'];
$requestToken = $oauthToken;
$oauthVerifier = $_GET['oauth_verifier'];
$accessTokenArray = $twitterOauthObj->getAccessToken($oauthVerifier, $oauthToken);
$oauthToken = $accessTokenArray['oauth_token'];
$oauthTokenSecret = $accessTokenArray['oauth_token_secret'];
$userTwitterId = $accessTokenArray['user_id'];
$screenName = $accessTokenArray['screen_name'];
}