Apache Oltu Linkedin Integration example

北城以北 提交于 2019-11-30 09:45:40

It seems that you're successfully obtaining an OAuth 2.0 access token, you'll need to pass access_token in a query parameter when making API calls. That's how OAuth 2.0 authentication is handled (OAuth 1.0 required the access token to be in the header whereas OAuth 2.0 relies on a query parameter).

For example:

GET https://api.linkedin.com/v1/people/~?oauth2_access_token={your-access-token}

Please follow the link, if in case requires more details: https://developer-programs.linkedin.com/forum/unknown-authentication-scheme

If you send token along with the request to access protected resources, then you should be getting the following details.

The corrected code snippet:

request= new OAuthBearerClientRequest
                ("https://api.linkedin.com/v1/people/~?oauth2_access_token="+oAuthResponse.getAccessToken()).
                buildQueryMessage();

In My Example, I am getting the following HTTP 200 OK response, just wanted to show you..

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<person>
  <id>LLIyXMKhNI</id>
  <first-name>FirstName</first-name>
  <last-name>LastName</last-name>
  <headline>Spring Developer at Amazon</headline>
  <site-standard-profile-request>
    <url>https://www.linkedin.com/profile/view?id=154416688&amp;authType=name&amp;authToken=ipNL&amp;trk=api*a4360331*s4423501*</url>
  </site-standard-profile-request>
</person>

Hope this will be help you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!