簡體   English   中英

Linkedin API 401 [未經授權]。 (帶有OAuthStarterKit的iOS)錯誤

[英]Linkedin API 401 [unauthorized]. (iOS with OAuthStarterKit) Error

嘗試從我的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:)];
}
}

到目前為止,使用Linkedin API花費了12個小時,我要做的就是獲取用戶的基本信息並能夠在Linkedin上共享,而使用Facebook和Twitter則花費了30秒。

首先,您的應用程序的基本配置文件中不允許使用r_fullprofile, r_contactinfo, rw_nus 如果要使用它們,則必須訂閱LinkedIN合作伙伴計划

其次,您必須打開w_share權限。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM