authentication - What's wrong with this Oauth process for LinkedIn + email? -
i'm using oneauth bundle in laravel, based on ninjauth fuel phil sturgeon, believe, , trying user's email address.
i've added proper scope request, , linkedin auth screen asks users permission basic profile , email address.. far, good..
a possible issue is: proper name of email field? i've found references email-address
, emailaddress
, 'emailaddress`...
the docs indicate email-address
, not working me :)
i'm using url: https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,member-url-resources,picture-url,location,public-profile-url,email-address)?format=json
this problematic snippet /bundles/oneauth/libraries/oauth/provider/linkedin.php
// create response request homecoming array( 'uid' => array_get($user, 'id'), // 'email' => array_get($user, 'email-address)', // 'email' => array_get($user, 'emailaddress)', 'name' => array_get($user, 'firstname').' '.array_get($user, 'lastname'), 'image' => array_get($user, 'pictureurl'), 'nickname' => $nickname, 'description' => array_get($user, 'headline'), 'location' => array_get($user, 'location.name'), 'urls' => array( 'linkedin' => $linked_url, ), );
if uncomment email field, request fails somehow (url still shows mysite.com/connect/callback favicon shows linkedin , ablank page in chrome: "error 324 (net::err_empty_response): server closed connection without sending data.
")
if email line in code above commented out, receive other details , new record added users table , table oneauth_clients, email naturally blank..
i must missing simple!
updatethe request url works email-address, returns json object containing emailaddress!!
the script still dies if homecoming array code above includes emailaddress
...
here someone's success story:
"i made these 2 changes library , demo.php respectively:
const _url_request = 'https://api.linkedin.com/uas/oauth/requesttoken?scope=r_basicprofile+r_emailaddress';
$response = $obj_linkedin->profile('~:(id,first-name,last-name,picture-url,email-address)');
the issue request token phone call is:
https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,member-url-resources,picture-url,location,public-profile-url,email-address)?format=json
but json response is:
array(8) { ["emailaddress"]=> string(18) "email@email.com" ["firstname"]=> string(3) "tim" ...
note in first case email named email-address, in sec emailaddress.
the secondary problem shortcoming of code - working perfectly!
authentication oauth linkedin laravel
No comments:
Post a Comment