VictorT
VictorT

Reputation: 783

LinkedIn authorization error

Could you please help me? I'm trying to login from iPhone application into LinkedIn and as result receive an error: oauth_problem=signature_invalid.

I receive it when I try to call method by URL https://api.linkedin.com/uas/oauth/accessToken with POST parameters:

OAuth realm="http://sp.example.com/", 
oauth_consumer_key="Z-sSugZBQPQGQTAymNEVSQTrBBrteG1x0PHwXWrtkvrNWfKJuzQ36AmwT1j8UBPh", 
oauth_token="19a1cc6e-597f-47ed-8d1c-778d05b25de3", 
oauth_signature_method="HMAC-SHA1", 
oauth_signature="vOfSRkbbC2%2FFw26wy6s%2FF5ThkS4%3D", 
oauth_timestamp="1323948893", 
oauth_nonce="431570D9-405F-4844-85E0-85722B53D397", 
oauth_version="1.0", 
oauth_verifier="12611"

I do not understand what is wrong. :(

Interesting, both Twitter and Facebook work fine.

Upvotes: 0

Views: 2236

Answers (2)

Kirsten Jones
Kirsten Jones

Reputation: 2706

My suspicion is that your signature isn't getting generated correctly - frequently when people have OAuth signature (401) errors when moving from GET to POST it's because the signature isn't getting generated correctly. I agree wholeheartedly with the suggestion to use the oauth-test-console on LinkedIn (which I created for this very situation). If you put the specific variables for your call into the form you should get an identical signature - if you don't it means your signature is getting generated incorrectly.

That having been said, I wrote an example LinkedIn iPhone Client (all it does is do authentication and get your profile). The library is here: https://github.com/synedra/LinkedIn-OAuth-Sample-Client

The LoginView is here: https://github.com/synedra/LinkedIn-OAuth-Sample-Client/blob/master/OAuthStarterKit/OAuthLoginView.m

The specific section you're looking for sounds like this method:

- (void)accessTokenFromProvider
{ 
  OAMutableURLRequest *request = 
    [[[OAMutableURLRequest alloc] initWithURL:accessTokenURL
           consumer:self.consumer
           token:self.requestToken   
           callback:nil
           signatureProvider:nil] autorelease];

    [request setHTTPMethod:@"POST"];
    OADataFetcher *fetcher = [[[OADataFetcher alloc] init] autorelease];
    [fetcher fetchDataWithRequest:request
      delegate:self
      didFinishSelector:@selector(accessTokenResult:didFinish:)
      didFailSelector:@selector(accessTokenResult:didFail:)];    

}

Upvotes: 1

Umesh Awasthi
Umesh Awasthi

Reputation: 23587

Its not a condition that if things are getting passed on one platform should get passed on another :)

As per my understanding there always have some differences in how a platform/service implement a given specifications.

suggest you to use Linked in Test Console to check what exactly is going wrong

LinkedIn oauth-test-console

Upvotes: 0

Related Questions