0
我正在使用Abhraham的twitter API庫。「無法驗證你」來自twitter API的錯誤
我的index.php
<?php
ob_start();
session_start();
require_once 'twitteroauth/twitteroauth.php';
require_once 'twitteroauth/OAuth.php';
define("CONSUMER_KEY", "");
define("CONSUMER_SECRET", "");
$to = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
$tok = $to->getRequestToken("http://mydoamin.com/twitter/redirect.php");
$request_link = $to->getAuthorizeURL($tok);
$_SESSION['oauth_access_token']= $tok['oauth_token'];
$_SESSION['oauth_access_token_secret'] = $tok['oauth_token_secret'];
header("Location: $request_link");
exit;
?>
我redirect.php
<?php
ob_start();
session_start();
require_once 'twitteroauth/twitteroauth.php';
require_once 'twitteroauth/OAuth.php';
define("CONSUMER_KEY", "");
define("CONSUMER_SECRET", "");
$to=new TwitterOAuth(CONSUMER_KEY,CONSUMER_SECRET,$_SESSION['oauth_access_token'],$_SESSION['oauth_access_token_secret']);
$content = $to->get('account/verify_credentials');
var_dump($content);
?>
但我不understant爲什麼我的redirect.php頁面上獲得"Could not authenticate you"
您確認您的sesison處理正在保留在下一頁上嗎? – Scuzzy
你真的想在這裏揭露你的鑰匙嗎? – vascowhite
@iThink現在更改您的Twitter API密鑰。即使他們被編輯出來,也爲時已晚。它們位於編輯歷史記錄中,Google緩存中以及任何已打開此頁面的瀏覽器中。 – jdl