1
votes

I am using PHP SDK for linkedIn https://github.com/zoonman/linkedin-api-php-client , the login process is fine and I am able to fetch basic profile for users. But when I fetch the list of pages that user is admin of , it throws fatal error.

Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: GET https://api.linkedin.com/v1/companies?is-company-admin=true resulted in a 403 Forbidden response: { "errorCode": 0, "message": "Member does not have permission to get companies as admin."

here is the code.

use LinkedIn\Client;
use LinkedIn\AccessToken;


$linkedClient = new Client('ID','SECRET');
$linkedInAccessToken = new AccessToken($_SESSION["linkedinToken"]);
$linkedClient->setAccessToken($linkedInAccessToken);

$companies = $linkedClient->get('companies',array('is-company-admin' => 
"true"));

var_dump($companies);

Two points to notify.

1) The linkedin user is actually an admin of two company pages. 2) Following permissions are given from linkedin App. r_basicprofile, r_emailaddress, rw_company_admin, w_share

I have spent hours searching for solution but the documentation is too vague. Any help will be greatly appreciated. Thank you !

1
datachant.com/2016/06/14/… Scroll down for the answeriwex

1 Answers

1
votes

Update: I solved the issue by passing $scopes array in getLoginURL() function. Although all these scopes are still ticked mark in application settings.