This is the function on twitteroauth.php file
I tried various examples for login in with twitter from my site, but I always get the same error
Undefined index: oauth_token in D:\wamp\www\login-with-twitter\oauth\twitteroauth.php on line 73
don't know what to do
function getRequestToken($oauth_callback) {
$parameters = array();
$parameters['oauth_callback'] = $oauth_callback;
$request = $this->oAuthRequest($this->requestTokenURL(), 'GET', $parameters);
$token = OAuthUtil::parse_parameters($request);
$this->token = new OAuthConsumer($token['oauth_token'], $token['oauth_token_secret']);// line 73
return $token;
}
And also
Notice: Undefined index: oauth_token in D:\wamp\www\login-with-twitter\index.php on line 34 Notice: Undefined index: oauth_token_secret in D:\wamp\www\login-with-twitter\index.php on line 35
if(isset($_GET['connect']) && $_GET['connect']=='twitter'){
$connection = new TwitterOAuth($this->consumer_key, $this->consumer_secret);// Key and Sec
$request_token = $connection->getRequestToken($this->oauth_callback);// Retrieve Temporary credentials.
$_SESSION['oauth_token'] = $token = $request_token['oauth_token']; //line 34
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret']; //line 35
switch ($connection->http_code) {
case 200: $url = $connection->getAuthorizeURL($token); // Redirect to authorize page.
header('Location: ' . $url);
break;
default:
echo 'Could not connect to Twitter. Refresh the page or try again later.';
}
}
Where you define your twitter
consumer key
consumer secret
their is also an option of :oauth callback
. please make sure you have same callback url as on your app settingcallback url
give it ashttps://dev.twitter.com/