问题描述
我正在将OAuth 1.0a用于LinkedIn API.目前,我已经实现了一些获取配置文件和连接的调用,它们似乎都可以正常工作.但是对于发送消息,oauth库将引发以下异常:
I'm using OAuth 1.0a for LinkedIn API. Currently, I've already implemented some calls for getting the profile and connections and they all seem to work fine. But for sending a message, the oauth library throws an exception with the following:
{
"errorCode": 0,
"message": "Unknown authentication scheme",
"requestId": "I2Y0MFJ8ME",
"status": 401,
"timestamp": 1378376573339
}
我正在使用PHP PECL OAuth.我正在像这样初始化$ oauth对象:
I'm using PHP PECL OAuth. I'm initializing the $oauth object like this:
$oauth = new OAuth(API_KEY, API_SECRET, OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_FORM);
$oauth->setToken(ACCESS_TOKEN, SECRET);
并像这样拨打其余电话:
and making the rest call like this:
$url = 'https://api.linkedin.com/v1/people/~/mailbox?format=json';
$content_type = array('Content-Type' => 'application/json');
$oauth->fetch($url, $message, OAUTH_HTTP_METHOD_POST, $content_type);
和$ message看起来像这样:
and $message looks something like this:
$message = Array
(
[recipients] => Array
(
[0] => z2222117O
)
[subject] => this is my title
[body] => this is my body
[format] => json
[id] => EAS123123
)
看起来请求没有任何问题.我已经按照 LinkedIn邮件文档中的说明进行操作.还有其他人有同样的问题吗?预先感谢.
It doesn't look like there's anything wrong with the request. I've followed the instructions from the LinkedIn messaging docs. Anyone else had the same problem? Thanks in advance.
推荐答案
我已经在下面的链接上回答了这个问题,似乎是同样的错误.尽管看似技术不同,但是将请求中的access_token发送回以获取受保护资源的解决方案是相同的.
I have answer the question on the below link, seems the same error. Though it seems different technology, but solution would be same to send the access_token in request back to get the protected resources.
供您参考的链接. Apache Oltu Linkedin集成示例
这篇关于LinkedIn API上的未知身份验证方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!