Hi,
Im trying to implement twitteroauth for signing in from twitter. So far I have sent the consumer key and secret to twitter and the page shows where the twitter user can authorise or deny access to the website they came from.
However, when I click authorise from api.twitter.com, the url isnt correct. the url looks like the following:
https://api.twitter.com/oauth/OAUTH_CALLBACK?oauth_token=XXXXXXXXXXXXXXXX&oauth_verifier=XXXXXXXXXXXXXXXXXXXXXXXXXX
I presume i dont want the api.twitter.com/oauth/ part in the url as i just want it to go to the callback that is specified.
Config.php:
<?php
define('CONSUMER_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXX');
define('CONSUMER_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
define('OAUTH_CALLBACK', 'www.example.co.uk/twitter/twitter_oauth.php');
?>
twitter_oauth.php:
require 'config.php';
require 'autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
session_start();
$request_token = [];
$request_token['oauth_token'] = $_SESSION['oauth_token'];
$request_token['oauth_token_secret'] = $_SESSION['oauth_token_secret'];
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
$request_token = $connection->oauth('oauth/request_token', array('oauth_callback' => OAUTH_CALLBACK));
$_SESSION['oauth_token'] = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
$url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
Im a newbie at this so I cant really understand whats going wrong, Ive tried fixing it for a while but I'm having no such luck, so any guidance would be much appreciated.