0
votes

I'm using java and I'm able to get the user access token. However I can not fetch data from linkedin. Here is my code:

F.Promise<WS.Response> res2 =WS.url("http://api.linkedin.com/v1/people/~:(first-name,last-name,positions,picture-url)")
  .setQueryParameter("Authorization","Bearer "+access_token)
get();

But I get Unknown authentication scheme error. I also tried setHeader instead of setQueryParameter but same thing! please help!!

2

2 Answers

0
votes

Use https instead of http. Also you are mixing headers with query parameters. Use only one. If you want to use headers you can do so with:

setHeader("Authorization", "Bearer " + accessToken)

if you want to use a query parameter:

setQueryParameter("oauth2_access_token", accessToken)     

LinkedIn Authentication Docs

0
votes

thanks alot salem, i forgot about https. now it works here is my code:

 F.Promise<WS.Response> res2 =WS.url("https://api.linkedin.com/v1/people/~:(first-name,last-name,positions,picture-url)")
                .setHeader("Authorization","Bearer "+access_token)
                .get();