Я думаю, что я правильно внедрил twitter oauth, но каждый раз, когда пользователь нажимает кнопку для входа через Twitter на моем сайте, он перенаправляется на https://twitter.com/oauth/authenticate?oauth_token=XYZ, где ему предлагается снова авторизовать мое приложение .
Мой исходный код основан на: http://www.9lessons.info/2011/02/login-with-facebook-and-twitter.html, который сам кажется основанным на https://github.com/abraham/twitteroauth/tree/master/twitteroauth
$twitteroauth = new TwitterOAuth(TWITTER_KEY, TWITTER_SECRET);
// Requesting authentication tokens, the parameter is the URL we will be redirected to
$request_token = $twitteroauth->getRequestToken($site_url.'getTwitterData.php');
// Saving them into the session
$_SESSION['oauth_token'] = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
// If everything goes well..
if ($twitteroauth->http_code == 200) {
// Let's generate the URL and redirect
$url = $twitteroauth->getAuthorizeURL($request_token['oauth_token']);
header('Location: ' . $url);
} else {
// It's a bad idea to kill the script, but we've got to know when there's an error.
die('The Twitter service is currently not responding. Please try again later.');
}
?>
В twitteroauth.php у меня ранее было:
function accessTokenURL() { return 'https://api.twitter.com/oauth/access_token'; }
function authenticateURL() { return 'https://twitter.com/oauth/authenticate'; }
function authorizeURL() { return 'https://twitter.com/oauth/authorize'; }
function requestTokenURL() { return 'https://api.twitter.com/oauth/request_token'; }
но затем попытался:
function accessTokenURL() { return 'https://api.twitter.com/oauth/access_token'; }
function authenticateURL() { return 'https://api.twitter.com/oauth/authenticate'; }
function authorizeURL() { return 'https://api.twitter.com/oauth/authorize'; }
function requestTokenURL() { return 'https://api.twitter.com/oauth/request_token'; }
, но не повезло.