2
votes

I set up an app on linkedIn. Set up and tested code to return an access token. Which all worked fine. I tried to get basic profile data and it says I do not have proper access rights. I gave the app all basic permission other than write posts so I am at a loss for why nothing is being returned.

The error:{"serviceErrorCode":100,"message":"Not enough permissions to access: GET /me","status":403}

My code is below.THETOKENWOULDBEHERE in the live code is the token returned by the oauth process. If anyone has any insights it would be appreciated.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.linkedin.com/v2/me");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-RestLi-Protocol-Version:2.0.0','x-li-format: json','Authorization: Bearer *THETOKENWOULDBEHERE*'));
$response = curl_exec($ch);
curl_close($ch);
print_r($response);
1
Explain the oauth request better. Using r_liteprofile and/or r_emailaddress scopes?ficuscr
@ficuscr I requested r_basicprofile r_emailaddress and rw_company_admin with the basic account it seems you only have access to 4 and I requested the 3 that looked to make sense. Do I need to request access to those others?kengTW
I've not RTFM but... stackoverflow.com/questions/50363237/… suggests r_basicprofile is'nt an option.ficuscr
I'll take a look at r_liteprofile. basic is an option and I didn't see lite as an option but I'll give it a shot.kengTW

1 Answers

0
votes

If you are using V2 and you did not taken permission to use r_basicprofile then either apply for permission to use r_basicprofile to linkedin or use r_liteprofile + r_emailaddress

Check this : https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context