有一些问题想换我的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