Linkedin API 401 [未经授权]。 (iOS with OAuthStarterKit)错误

时间:2012-10-03 03:42:29

标签: ios api linkedin

我在尝试从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上分享,这需要30秒才能通过Facebook和Twitter。

1 个答案:

答案 0 :(得分:0)

首先,您的应用程序中的基本配置文件中不允许update tableA INNER JOIN tableB ON tableA.col1 = tableB.col1 set tableA.col1 = table2.col2 。如果您想使用它们,则必须订阅LinkedIN Partnership Programs

其次,您必须启用r_fullprofile, r_contactinfo, rw_nus的权限。

相关问题