miron
miron

Reputation: 1450

LinkedIN REST API does not return emailAddress field although r_emailaddress set in app scope

As mentioned above, my App has the r_emailaddress permission activated in its scope settings.

When I retrieve the oauth2 access token and use it to get data from the authenticated user I will get all fields except the email address.

Here is my request:

curl -H "Authorization: Bearer $LI_ACCESS_TOKEN" "https://api.linkedin.com/v1/people/~:(id,first-name,last-name,email-address)?format=json" -X GET

Returns

{
  "firstName": "John",
  "id": "som31d",
  "lastName": "Doe"
}

I noticed that when I use the JS SDK all requested data is returned. So where comes the deviation come from ?

Upvotes: 2

Views: 3019

Answers (1)

miron
miron

Reputation: 1450

I found the problem. I issued the request for the authorization code with the scope parameter containing only the r_basicprofile permission.

Provide r_emailaddress additionally to get them E-Mail address.

Correct:

curl -i "https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=clientid&redirect_uri=http://localhost:8088&state=987654321&scope=r_basicprofile,r_emailaddress" -X GET

Upvotes: 4

Related Questions