2

当我尝试从我的 iPhone 应用程序发布状态更新时,我收到了这个回复。而且我不知道自己做错了什么,我一直在进出文档,数据包嗅探,linkedin 论坛和代码与 Linkedin API 怪物战斗,但我无法克服这个错误,并且希望知道任何人的任何指示,我可以做些什么来解决和/或解决这个问题:

data: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
<status>401</status>
<timestamp>1349234286875</timestamp>
<request-id>ZAAVLR7K6H</request-id>
<error-code>0</error-code>
<message>[unauthorized]. OAUxxxxxxxx-xxxxxxxx|*xx|*xx:xxxxxxxx:lxxxxxxxxxxxxxxxx=</message>
</error>

我请求这些权限: r_fullprofile r_contactinfo r_emailaddress, rw_nus 用于授权。

图形路径设置为:

http://api.linkedin.com/v1/people/~/shares

授权后我的基本签名如下所示:

POST&http%3A%2F%2Fapi.linkedin.com%2Fv1%2Fpeople%2F~%2Fshares&oauth_consumer_key%3Diws9c2xtzgdr%26oauth_nonce%xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1349234713%26oauth_token%xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx%26oauth_version%3D1.0

我调用的主要代码如下:

- (void) updateStatus : (NSString *) status{
if (self.consumer != nil) {
OAMutableURLRequest *request =
[[OAMutableURLRequest alloc] initWithURL: requestURL
consumer: self.consumer
token: self.accessToken
callback: nil
signatureProvider: nil];

NSMutableDictionary *permsDict = [NSMutableDictionary dictionary];

[permsDict setValue: @"anyone" forKey: @"code"];

NSMutableDictionary *shareJSONDict = [NSMutableDictionary dictionary];

[shareJSONDict setValue: permsDict forKey: @"visibility"];
[shareJSONDict setValue: @"test" forKey: @"comment"];

[request setValue:@"application/json" forHTTPHeaderField:@"x-li-format"];

NSString *updateString = [shareJSONDict JSONString];

[request setHTTPBodyWithString:updateString];
[request setHTTPMethod:@"POST"];

OADataFetcher *fetcher = [[OADataFetcher alloc] init];

[fetcher fetchDataWithRequest: request
delegate: self.sessionDelegate
didFinishSelector: @selector(postUpdateApiCallResult:didFinish:)
didFailSelector: @selector(postUpdateApiCallResult:didFail:)];
}
}

到目前为止,我花了 12 个小时与 Linkedin API 争论,我需要做的就是获取用户的基本信息并能够在 Linkedin 上分享,而在 Facebook 和 Twitter 上花了 30 秒。

4

1 回答 1

0

首先,r_fullprofile, r_contactinfo, rw_nus不允许在您的应用程序的基本配置文件中使用。如果您想使用它们,您必须订阅LinkedIN 合作伙伴计划

其次,您必须为w_share.

于 2017-01-24T15:20:11.873 回答