有一些問題想換我的REST OAuth憑證JSAPI令牌(https://developer.linkedin.com/documents/exchange-jsapi-tokens-rest-api-oauth-tokens)LinkedIn的Oauth問題 - oauth_verifier
我使用這個庫 - http://code.google.com/p/oauth-php/ - 而不是PECL擴展因爲我無法安裝擴展到服務器上。
似乎有成爲很多類似的問題,但沒有這實際上回答的問題 - 如何使用上述庫LinkedIn進行身份驗證。
我的代碼如下:
$cookie_name = "linkedin_oauth_" . $this->_c->linkedin_api_key;
$credentials_json = stripslashes($_COOKIE[$cookie_name]);
$credentials = json_decode($credentials_json);
// Get the Access Token + Secret
$access_token_url = 'https://api.linkedin.com/uas/oauth/accessToken';
OAuthStore::instance("2Leg", array(
'consumer_key' => $this->_c->linkedin_api_key,
'consumer_secret' => $this->_c->linkedin_api_secret
));
try {
$request = new OAuthRequester($access_token_url, 'POST', array(
'xoauth_oauth2_access_token' => $credentials->access_token
));
$result = $request->doRequest();
} catch(OAuthException2 $e) {
print_r($e->getMessage());
}
catch語句輸出:
Request failed with code 400: oauth_problem=parameter_absent&oauth_parameters_absent=oauth_verifier
我如何獲得這個oauth_verifier?這是我的理解,我並不需要它,如果我經過xoauth_oauth2_access_token了嗎?
我已經檢查了所有的變量即$憑證和$ this - > _ c並且所有變量都正確傳遞。
我還提交了[錯誤](http://code.google.com/p/oauth-php/issues/detail?id=124)至封裝的維護者爲好。 – 2012-04-13 01:29:48
哇。謝謝你,傑里米..這是排序問題! – 2012-04-13 09:22:21
我的榮幸!花了一段時間來跟蹤這個問題,即使我有關於這個問題的經驗,所以我可以想象它引起他人的挫折感。 – 2012-04-16 16:59:20