springlinkedin-apispring-socialspring-social-linkedin

Spring-social-linkedin application token (without user authentication)


I'd like to be able to use spring-social-linkedin with an application token much like I can do with spring-social-facebook with workarounds (Use app access token with spring-social facebook to query public pages).

My application only needs to query public pages, so should not need to be authenticated against a specific user: for example I'd query a public company page http://www.linkedin.com/company/google

I've been reading lots of documentation, but I'm a bit confused about where things are currently at. I don't think you can even instantiate a LinkedInTemplate any more with OAuth1 credentials via the constructor and the doco seems outdated (http://docs.spring.io/spring-social-linkedin/docs/1.0.x/reference/htmlsingle/#apis).

Does anyone know if LinkedIn has the capability of sever integration without the redirect_uri dance (obviously with only access to a subset of APIs that correlate to public info)?


Solution

  • Apparently the new documentation wasn't properly published when SSLI 1.0.0.RELEASE was pushed. Thanks for the heads up...I'll try to get that fixed.

    In the meantime...per LinkedIn's API documentation at https://developer.linkedin.com/documents/company-lookup-api-and-fields, all requests for company data must use an access token to make an authenticated call on behalf of a user. Therefore, you must get user authorization before you can make such calls. I believe that was true whether you are using OAuth 1.0a or OAuth 2.

    Spring Social LinkedIn assumes that you'll be using OAuth 2 authorization, which is also what LinkedIn expects most apps will do (see https://developer.linkedin.com/documents/authentication). Therefore, all you need to give to LinkedInTemplate when instantiating it is a valid access token. How you obtain that access token, however, is another matter.

    Spring Social's ConnectController can help you with the OAuth dance. But it sounds like you're wanting to know how to get an access token for the application, without involving user authorization. As far as I can tell (although I'll be happy to be corrected on this), LinkedIn does not support OAuth 2 client authorization. They do give you an access token on your application's registration page, but as best as I can tell, that's an OAuth 1.0a token and will not work with Spring Social. Even so, that token is still a user token...it's just a token authorized for you.

    So, if company requests require an access token authorized to act on behalf of a user (per the docs), then I do not think you have any choice but to obtain an access token via user authorization. I suppose that you could authorize yourself and use that token for your application, but that's probably a misuse of the token...proceed at your own risk.