我想簽署一個用戶使用雅虎。我正在使用Yos社交php5 sdk。它要求獲得許可,然後死於錯誤token_rejected。雅虎YOS社交PHP5庫錯誤
這就是我所能得到的。這是我的代碼看起來像(注:我在笨使用此):
function yahoo($url) {
if($url == 'login') {
$url = base_url('user/yahoologin');
} else {
$url = base_url('user/yahooregister');
}
set_include_path(APPPATH . "libraries/Yahoo");
require_once APPPATH . "libraries/Yahoo/OAuth/OAuth.php";
require_once APPPATH . "libraries/Yahoo/Yahoo/YahooOAuthApplication.class.php";
$CONSUMER_KEY = 'consumerkey--';
$CONSUMER_SECRET = 'secret';
$APPLICATION_ID = 'appid';
$CALLBACK_URL = $url;
$oauthapp = new YahooOAuthApplication($CONSUMER_KEY, $CONSUMER_SECRET, $APPLICATION_ID, $CALLBACK_URL);
# Fetch request token
$request_token = $oauthapp->getRequestToken($CALLBACK_URL);
# Redirect user to authorization url
$redirect_url = $oauthapp->getAuthorizationUrl($request_token);
redirect($redirect_url);
}
public function yahoologin() {
set_include_path(APPPATH . "libraries/Yahoo");
require_once APPPATH . "libraries/Yahoo/OAuth/OAuth.php";
require_once APPPATH . "libraries/Yahoo/Yahoo/YahooOAuthApplication.class.php";
$CONSUMER_KEY = 'consumerkey--';
$CONSUMER_SECRET = 'secret';
$APPLICATION_ID = 'appid';
$CALLBACK_URL = base_url("user/yahoologin");
$oauthapp = new YahooOAuthApplication($CONSUMER_KEY, $CONSUMER_SECRET, $APPLICATION_ID, $CALLBACK_URL);
# Fetch request token
$request_token = $oauthapp->getRequestToken($CALLBACK_URL);
# Exchange request token for authorized access token
$access_token = $oauthapp->getAccessToken($request_token, $_REQUEST['oauth_verifier']);
# update access token
$oauthapp->token = $access_token;
# fetch user profile
$profile = $oauthapp->getProfile();
var_dump($profile);
}
我得到的唯一錯誤是這樣的:
YahooOAuthAccessToken Object
(
[key] =>
[secret] =>
[expires_in] =>
[session_handle] =>
[authorization_expires_in] =>
[yahoo_guid] =>
[oauth_problem] => token_rejected
)
而這在$access_token = $oauthapp->getAccessToken($request_token, $_REQUEST['oauth_verifier']);
線。任何協助,讓這項工作?我認真地認爲雅虎有史以來最糟糕的API。