Search code examples
cocoaoauthwebkitwebviewlinkedin-api

LinkedIn API + WebKit


I'm trying to use the OAuthConsumer library for Cocoa to connect to users' LinkedIn accounts.

Following the steps provided by the original author of OAuthConsumer, I set up the request token, and point a WebView at the resulting URL.

Now, with other services that I've used OAuthConsumer for (Twitter, Facebook, etc.), this part works fine. The user logs in, authenticates the app, and then my code kills off the WebView and trades in the newly authorized request token for an access token.

However, with LinkedIn, I'm getting the error "We were unable to find the authorization token". No more information; no error codes. Just a neatly rendered webpage full of useless.

LinkedIn Error Page

So, I ultimately have no idea where to even beging debugging this issue, or whether or not it's a problem with my code at all. The few minor leads I've been able to find on LinkedIn's forums state that my "timestamp may be off" (though, not according to Epoch Converter), and I should check the "timestamp in the response". Seems like a red herring to me.

Edit:

Charles Session


Solution

  • So, it turns out the parameter for returning the request token is "oauth_token", not "token", as I was using.

    Now, this would ordinarily just be a commentary on the inconsistencies of OAuth implementation, and my oversight. However, I'm a bit concerned because there were several instances (mostly using a browser) where using the wrong parameter in the return query would work: a serious inconsistency, and potentially severe oversight on LinkedIn's part.

    At any rate, it works now.