2012-10-03 137 views
2

我試圖從iPhone應用發佈狀態更新時收到此回覆。我不知道自己做錯了什麼,我一直在進出文檔,數據包嗅探,linkedin論壇和代碼與Linkedin API怪物作戰,但我無法克服這個錯誤,並且將來自於認識的人,以我能做些什麼來解決和/或解決這個問題的任何指針喜愛:Linkedin API 401 [未經授權]。 (帶有OAuthStarterKit的iOS)錯誤

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爭吵,所需要做的就是獲取用戶的基本信息和b能夠在Linkedin上分享,這與Facebook和Twitter需要30秒。

+1

你有沒有想過這個? – user3344977

回答

0

首先r_fullprofile, r_contactinfo, rw_nus不允許在您的應用程序的基本配置文件中。如果您想使用它們,您必須訂閱LinkedIN Partnership Programs

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

相關問題