2
votes

I recieved this reply, when trying to post a status update from my iPhone app. And I don't know what I'm doing wrong, I've been in and out of documentation, packet sniffing, the linkedin forums and code doing battle with the Linkedin API monster, but I'm unable to get past this error, and would love for any pointers from anyone in the know as to what I can do to troubleshoot and/or solve this problem:

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>

I request these permissions: r_fullprofile r_contactinfo r_emailaddress, rw_nus for authorisation.

The graph path is set to:

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

My base signature after Authorisation looks like:

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

The main code I call to kick this off looks like:

- (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 Hours spent wrangling with the Linkedin API so far, all I need to do is get the users basic info and be able to share on Linkedin, something that took 30 seconds with Facebook and Twitter.

1
Did you ever figure this out? - user3344977

1 Answers

0
votes

First of all r_fullprofile, r_contactinfo, rw_nus are not allowed in basic profile in your application. If you want to use them you have to be subscribed to LinkedIN Partnership Programs.

Second, you have to turn on permission for w_share.