logical-and / php-oauth

Support for authenticating users (without dep from any framework) using both OAuth1 and OAuth2 methods
https://packagist.org/packages/and/oauth
MIT License
43 stars 13 forks source link

Issues getting Linkedin Email #58

Open erswelljustin opened 8 years ago

erswelljustin commented 8 years ago

I am following the example for the linkedin call

$data = $linkedinService->retrieveAccessTokenByGlobReqArgs()->requestJSON('/v1/people/~?format=json');
$data['email'] = $linkedinService->constructExtractor()->getEmail();
$this->debug($data);return;

My output looks like this:

array (
  'firstName' => 'Justin',
  'headline' => 'Job title at Company',
  'id' => 'aDdbiLdLNv',
  'lastName' => 'Erswell',
  'siteStandardProfileRequest' => 
  array (
    'url' => 'https://profileurl',
  ),
  'email' => NULL,
)

I have tried with multiple linked in accounts and every time I get the profile information but no email address I am constructing my call thus:

$linkedinService = $serviceFactory->createService(
    'linkedin',
    $credentials,
    $storage,
    array('r_basicprofile', 'r_emailaddress'),
    null,
    true
);

After some googling I have also tried using the following in the requestJSON call ~:(id,first-name,last-name,headline,member-url-resources,picture-url,location,public-profile-url,email-address) but this returns the issue described in this posted item #46 posted by @appsol

In addtion I have ensured that my version of League\URL is running at 3.3.5 as the one required by the package had some bugs with the URL parser I believe.

Can you help me to resolve this please.

Thanks!