Happyr / LinkedIn-API-client

A library to connect with LinkedIn API. Perfect if you are looking for an API client or SDK for LinkedIn
MIT License
198 stars 97 forks source link

Could not get access token: The user may have revoked the authorization response from LinkedIn.com was empty. #139

Closed MAXI279 closed 7 years ago

MAXI279 commented 7 years ago
Q A
Bug? no yes
New Feature? no
Are you using composer? yes
Version Specific version or SHA of a commit

Actual Behavior

What is the actual behavior? Im trying to login using the example code given and everything is ok but after accept app to use my linkedin information this error appears, i read a lot but i couldn´t find a solution

Expected Behavior

What is the behavior you expect? Obtain access token and successful login

Steps to Reproduce

im using laravel 5.3 and the following code in one of my routes

$linkedIn=new Happyr\LinkedIn\LinkedIn('CLIENT ID', 'SECRET ID');

if ($linkedIn->isAuthenticated()) {
    //we know that the user is authenticated now. Start query the API
    $user=$linkedIn->get('v1/people/~:(firstName,lastName)');
    echo "Welcome ".$user['firstName'];

    exit();
} elseif ($linkedIn->hasError()) {
    echo "User canceled the login.";
    exit();
}

//if not authenticated
$url = $linkedIn->getLoginUrl();
echo "<a href='$url'>Login with LinkedIn</a>";

thanks !!

Nyholm commented 7 years ago

How did you solve your issue?

MAXI279 commented 7 years ago

The problem is solved, it was related with this error "cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"

So i add a cacert.pem downloaded from https://curl.haxx.se/ca/cacert.pem into php.ini

; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo = "absolute route in server"

and problem solved. thanks

Nyholm commented 7 years ago

Awesome. Thank you for reporting this!

yogeshbonzer commented 7 years ago

Hello Nyholm I also got following error - "Could not get access token: The user may have revoked the authorization response from LinkedIn.com was empty. "

I read a lot. But not find answer. Could you give me sample code, how to get access token from 'code' (after user allow access) and so I can store in db.. For reference I have attached my code snippet here. Could you please help me in this My symfony2 application code is below-- `/**