GithubHelp home page GithubHelp logo

happyr / linkedin-api-client Goto Github PK

View Code? Open in Web Editor NEW
198.0 198.0 97.0 254 KB

A library to connect with LinkedIn API. Perfect if you are looking for an API client or SDK for LinkedIn

License: MIT License

PHP 100.00%

linkedin-api-client's People

Contributors

asch3ron avatar cwspear avatar ehacke avatar irfanevrens avatar mauri870 avatar mbarwick83 avatar monsieurmechant avatar nyholm avatar pascalwacker avatar ravigehlot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linkedin-api-client's Issues

CSRF state token does not match one provided

Getting this error when redirecting after successful log in.
Fatal error: Uncaught Exception: CSRF state token does not match one provided. thrown in ~/HappyR/LinkedIn/LinkedIn.php on line 310.
At the point when the exception is thrown the state variable is actually empty, which causes the exception, but I can't really figure out why is this happening.

Server 500 error

Hi, Nyholm.
I download your source code and install it by composer.
as a result, vendor folder is created.
I changed the name 'happyr' to Happyr and 'linkedin-api-client' to 'LinkedIn'
and create a "index.php" to call it.
it's some code is
require_once 'autoload.php';
$linkedIn=new Happyr\LinkedIn\LinkedIn('756k6wdtntngffs','AtXwifuEIoff4xWvbb');
and copy index.php to vendor folder.
But When i test it, it occurs "Server 500 error".
I made something wrong when install it.
Please tell me the way.
thx.

Uncaught GuzzleException: cURL error 77 during share API call

( ! ) Fatal error: Uncaught GuzzleException: cURL error 77: See http://curl.haxx.se/libcurl/c/libcurl-errors.html thrown in C:\xampp\htdocs\magento\lib\Connectors\Linkedin\src\Http\GuzzleRequest.php on line 50

image

Here what i tried

  require_once('path_To_autoload_dir/autoload.php');
  $linkedIn=new Happyr\LinkedIn\LinkedIn($connectorApiKey,    $connectorApiSecretKey);
  $linkedIn->setAccessToken($userAuthenticationKey);
  $options = array('json'=>
  array(
     'comment' => $statusUpdate,
      'visibility' => array(
      'code' => 'anyone'
    )
   )
   );
   $result = $linkedIn->post('v1/people/~/shares', $options);
    var_dump($result);

$linkedIn->isAuthenticated() always returning false

Hello,

This is not about a "real" issue but I'm stuck with my problem, trying to make a LinkedIn Connect.
I did some LinkedIn connects but right now I don't know where my issue can be.

In the login process everything is going well, but at the end both $linkedIn->isAuthenticated() and $linkedIn->hasError() return false, because the access token might not be recognized.

The only difference I found with my other made LinkedIn Connects (using your lib) is that the urls are encoded so the GET parameters might not work well.

Here is a var_dump($_GET):

array (size=1)
  'code=AAAZyVupt8xF-0-UCdC9-P-HAYaS54Mos7f71JQ-M-OKUlSk1j0KwQ7FRy0Nd0tzbl8lQ7-petcUWA4TrNZ_V9WssMOQEHUWkBXGi-Zz4aFpXJ9cywc&state=eabddd7452008ca50ead94a050a547786' => string '' (length=0)

So I tried to repopulate it correctly as it follows:

array (size=2)
  'code' => string 'AAAZyVupt8xF-0-UCdC9-P-HAYaS54Mos7f71JQ-M-OKUlSk1j0KwQ7FRy0Nd0tzbl8lQ7-petcUWA4TrNZ_V9WssMOQEHUWkBXGi-Zz4aFpXJ9cywc' (length=115)
  'state' => string 'eabddd7452008ca50ead94a050a547786' (length=32)

But $linkedIn->isAuthenticated() is still returning false :/ so it may not be related to the urls encoding.

Any idea how I could get it working?

Thanks

Post Content to a LinkedIn Page

How can I use your API to post content to a linked in page? I have the user accept the permission rw_company_admin. So how would I post an update to their company page?

Move to guzzle v6?

At the moment this package is tied to guzzle ~5.0, so you cannot install it if you have, let's say, guzzle 6 (Laravel out of box got it)

Would be useful to migrate to newer guzzle, rather than forcing people to fork :)

CurlException

Hi,

I'm getting this error while accessing access token, I explored code and found this issue:
SSL certificate problem: unable to get local issuer certificate

I tried CURLOPT_SSL_VERIFYHOST => false, but error is still the same.

Thanks,
Riza

Unusable without the authentication procedure

Some people use oauth through other libraries. A user needs to be able to set an access token along with the app key and secret and be able to use it. I took a quick look but it doesn't seem to be possible.

The request class needs to set an additional header if so:

Authorization: Bearer [access token]

JSON requests need the following header also:

x-li-format: json

start-timestamp option doesn't look to be used

Hello,

I'm trying to get the Historical Status Update Statistics data for a company page.

According to https://developer-programs.linkedin.com/historical-company-statistics#toggleview:id=json it needs a start-timestamp option.

This is my URI:

https://api.linkedin.com/v1/companies/[company_id]/historical-status-update-statistics:(like-count,impression-count,click-count,comment-count,share-count)?time-granularity=day&start-timestamp=1452073276

The 1452073276 is the timestamp from yesterday ("2016-01-06 09:41:16.000000" to be exact), and yet when I dump the returned data, the first one returned is from 2013.

Did I miss something (again) about this ?

I'm thinking linkedin is reading the option, since if I remove it, it returns the message saying it's required.

Edit: 1452073276 in milliseconds 1452073276000 provides the same result

scopes as consts?

Would it be a good idea to have the scope's as library constants as opposed to strings?

Guzzle

How do I include guzzlehttp with this library? I keep getting
Fatal error: Class 'GuzzleHttp\Client' not found in /home/jobminx/public_html/api/App/Happyr/Linkedin/Http/GuzzleRequest.php on line 89

I have put the GuzzleHttp folder in every folder on my site?

Why you hardcoded payloads?

 protected function getUserFromAccessToken()
    {
        try {
            // Here!
            return $this->api('GET', '/v1/people/~:(id,firstName,lastName,headline)'); 
        } catch (LinkedInApiException $e) {
            return;
        }
    }

Please provide the ability to specify parameters.

Any way to run without composer?

Sorry to ask an idiotic question, but I can't get higher than php 5.3 on my server, so can't install via composer. I am wanting to try out the LinkedIn api, having experience with Twitter and Facebook, both of which allow me to bypass composer installation by just doing a "require_once" of a file that exists in the library I download and then put on my server. Any workaround to do this with yours?

Thanks in advance, I know this is a really basic issue, so I apologize for my ignorance!

getting error url generator

Fatal error: Class 'HappyR\LinkedIn\Http\UrlGenerator' not found in F:\xampp\htdocs\test9\HappyR\LinkedIn\LinkedIn.php on line 110
i using it in core php ,why i am facing this problem,or i calling wrong in php so help me how call in core php

Generic Error

I'm not sure what the issue is, when I try to get the authtoken by passing the code I keep getting the following, but I've followed the API example exactly.

Fatal error: Uncaught GuzzleException: 400: missing required parameters, includes an invalid parameter value, parameter more than once. : Unable to retrieve access token : appId or redirect uri does not match authorization code or authorization code expired thrown in /home/public_html/dev/api/linkedIn/vendor/happyr/linkedin-api-client/src/Http/GuzzleRequest.php on line 38

_toString() must return a string value

Hello,

I've been using your lib since a few weeks now, and I'm often getting this error:

protected 'message' => string 'Method Happyr\LinkedIn\AccessToken::__toString() must return a
string value' (length=75)
private 'string' (Exception) => string '' (length=0)
protected 'code' => int 0
protected 'file' => string '/x/lib/vendor/happyr/linkedin-api-client/src/LinkedIn.php' (length=80)
protected 'line' => int 132

Which seems to come from the api() method. I'm getting this error if I reload my callback page, or if I execute $linkedIn->isAuthenticated() when the user failed his linkedin authentication.

Here is my actual code:

function linkedin_callback(){
    if(db_membre_amiral::current()){
        flash('danger', 'Vous êtes déjà connecté.');
        redirect_to('/');
    }

    $linkedIn = new Happyr\LinkedIn\LinkedIn(option('linkedin_id'), option('linkedin_secret'));

    if ($linkedIn->isAuthenticated()) {
        $user = $linkedIn->get('v1/people/~:(firstName,lastName,email-address,id,positions,picture-urls::(original),picture-url)');
        //var_dump($user); die;
        $membre_amiral = db_item::find_by('membre_amiral', 'linkedin_id', $user['id']);
        if($membre_amiral){
            if($membre_amiral->linkedin_token != $linkedIn->getAccessToken()){
                $membre_amiral->update(array('linkedin_token' => $linkedIn->getAccessToken()));
            }
        } else {
            if(empty($user['positions']['values'][0]['company']['name'])){
                $societe = '';
            } else {
                $societe = $user['positions']['values'][0]['company']['name'];
            }

            if(!empty($user['pictureUrls']['values'][0])){
                $photo = $user['pictureUrls']['values'][0];
            }
            else if(!empty($user['pictureUrl'])){
                $photo = $user['pictureUrl'];
            } else {
                $photo = '';
            }

            $membre_amiral = db_item::create('membre_amiral', array(
                'email' => $user['emailAddress'],
                'nom' => $user['lastName'],
                'prenom' => $user['firstName'],
                'societe' => $societe,
                'linkedin_id' => $user['id'],
                'linkedin_token' => $linkedIn->getAccessToken(),
                'photo' => $photo,
            ));
        }
        $token = intval($membre_amiral->id) . '_' . sha1($membre_amiral->email . NAME_PROJET . $membre_amiral->password) . '_'.md5(option('engine'));
        $_SESSION['auth'][option('engine')] = $token;
        if (db_membre_amiral::current()) {
            //flash('success', 'Connexion réussie.');
                    redirect_to('/compte/projets/');
        }
    }
    elseif ($linkedIn->hasError()) {
        flash('danger', 'Connexion annulée.');
            redirect_to('/');
    }
}

I just placed the $linkedIn->hasError() condition before $linkedIn->isAuthenticated() and it solved my problem, but I think you should fix your example code or your isAuthenticated() method as it shouldn't throw exception.

Also, in the main LinkedIn class I found:

10 . When you make a second request to the api you skip the authorization (1-3) and the "code for access token exchange" (6-8).

I couldn't get it working I think the token is stored but no problem for me I only need one API call.

Thanks for reading,
Have a good day

Not able get past authorization

Hello,

I am using this on a WordPress project. I only want to get a specific company's updates.

I initially got facade fatal errors which I resolved using this.

"That is because you don't use the Facade.
Remove the vendor folder and install it again with composer update --no-dev and you will use the global $_SESSION array."

Now I cant seem to get past this check
if ($linkedIn->isAuthenticated()) { // my code }

I have double checked the App keys.

I am not sure why its not authenticating and I am not sure how to check for any errors. Any help or information would be highly appreciated. Thanks

no authentication, no error

My app redirects successfully to the authorization dialog but never gets an access code. I receive the state and an authorization code but cant seem to retrieve a token for the user and the api is showing no error. i suspect it is a session issue but i am not sure.

Can't Use This API to POST Direct Messages

Using the following function, it seems currently impossible to make a request like this with this API:

public function sendDirectMessage(array $ids, array $message)
{
    $payload = [
        "recipients" => [
            "values" => []
        ],
        "subject" => $message['subject'],
        "body"    => $message['body']
    ];

    foreach ($ids as $id) {
        $payload['recipients']['values'][] = [
            "person" => [
                "_path" => "/people/id={$id}",
            ]
        ];
    }

    $result = $this->linkedIn->api('v1/people/~/mailbox', [], 'POST', $payload);

    return $this->processResult($result);
}

The first issue is in HappyR\LinkedIn\Http\Request.php on line 48. POSTFIELDS needs to be json_encoded for JSON requests (and probably just passed through for XML, but I try and stay away from XML).

The second issue is the same file on lines 55-61. It needs to set the proper header based on JSON or XML. I can make a PR for what needs to be done for the JSON, but I really don't want to mess with the XML :-/

And I'm not super familiar with the LinkedIn API, but is query params ever what the API is looking for if it's a POST??

Error handling is not supported

It looks like you are not supporting the error handling when a user cancels the authentication request. This will result in a query parameter "error" sent back to the redirect_uri. I don't see any code to handle this scenario. Is it omitted intentionally?

Authentication not working

Hi,

There's something really weird going on. I don't know if this is temporal LinkedIn issue or something with this client.

Anyway I can't get AccessToken.

Application redirects nicely to LinkedIn authorization url and redirects back after approval, but then I get this message: Exception: Could not get access token.

I also tried with pure example code, but got the same results.

Anything to do with Poodle" SSL vulnerability? Even though I didn't find any traces of SSL being used.

Any thoughts?

Getting Error Message

When I try installing this via composer/terminal, I get the following error. I'm using Laravel 5.1. Guzzle6.

composer require happyr/linkedin-api-client:dev-master php-http/httplug:v1.0.0-beta

  Problem 1
    - Installation request for happyr/linkedin-api-client dev-master -> satisfiable by happyr/linkedin-api-client[dev-master].
    - happyr/linkedin-api-client dev-master requires php-http/client-implementation 1.0 -> no matching package found.

String could not be parsed as XML

Hi,

#49
like above mentioned sollution for issue, I tried adding this line $linkedIn->get('/url', ['verify' => false]);
to your sample code i am getting issue like below
linkedin

my code will look like this,

get('/url', ['verify' => false]); 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(); ``` } else if ($linkedIn->hasError()) { echo "User canceled the login."; exit(); } //if not authenticated $url = $linkedIn->getLoginUrl(); echo "Login with LinkedIn"; ?>

you can point me in the right direction for debugging this.

Thank you

Selva ganapathi

Unable to use API-client

Hello, after giving authorisation I get the following error:

Fatal error: Uncaught exception 'RuntimeException' with message 'Puli Factory is not available' in /Users/Dirk/Develop/www/pebbler/sites/rezelman/dashboard/vendor/php-http/discovery/src/ClassDiscovery.php:32 Stack trace: #0 /Users/Dirk/Develop/www/pebbler/sites/rezelman/dashboard/vendor/php-http/discovery/src/ClassDiscovery.php(79): Http\Discovery\ClassDiscovery::getPuliFactory() #1 /Users/Dirk/Develop/www/pebbler/sites/rezelman/dashboard/vendor/php-http/discovery/src/ClassDiscovery.php(99): Http\Discovery...

Since I didn't use composer.phar before I have no clue how to solve this. I followed the install-instruction and used the demo-code for authentication.
Can someone point me out how to solve this?

Thanks in advance.

Dirk Schaap

Getting header data from API result

LinkedIn API returns some information in HTTP header fields after an API call.

For example, a POST to v1/groups/xyz/posts to create a "Group Message" will return a HTTP result like this:

HTTP/1.1 201 Created
X-LI-UUID: q0SEmZ0/0BOAZp3TbSsAAA==
Date: Mon, 30 Mar 2015 10:23:47 GMT
Vary: Accept-Encoding
Content-Length: 0
X-Li-Fabric: PROD-ELA4
*Location: https://api.linkedin.com/v1/posts/g-8283043-S-5988253677960318977 *
x-li-request-id: ROT1ZIN59B
X-Li-Pop: prod-lva1
Connection: keep-alive
Server: Apache-Coyote/1.1

How can we get this "Location" information from the HTTP header of the result?

Thanks!

Token expiration date

Would be great if there would be some way how to retrieve access token expiration date.

At the moment as far as I see there isn't anything like that. I also cannot retrieve expires_in value from access token response.

How can i post to wall?

Hi, Nyom!
I wrote login.php file like below.

isAuthenticated()) { //we know that the user is authenticated now. Start query the API $user=$linkedIn->get('v1/people/~:(firstName,lastName)'); $_SESSION['mylk_accesstoken']=$linkedIn->getAccessToken(); echo "Welcome ".$user['firstName']; $options = array('json'=> array( 'comment' => 'Im testing Happyr LinkedIn client! https://github.com/Happyr/LinkedIn-API-client', 'visibility' => array( 'code' => 'anyone' ) ) ); $result = $linkedIn->post('v1/people/~/shares', $options); var_dump($result); exit(); } elseif ($linkedIn->hasError()) { echo "User canceled the login."; session_destroy(); exit(); } ``` //if not authenticated $url = $linkedIn->getLoginUrl(); echo "Login with LinkedIn"; ``` It works to login correctly and no error occurs. But "https://www.linkedin.com/nhome" -Profile\Your UPdates has no updates. I think Post api doesn't work. What reason? Please tell me about it. Best regards.

Incorrect formatting of request when setting format

Hello!

I found an issue where when I set my default output to JSON like so:

$linkedIn = new Happyr\LinkedIn\LinkedIn($key, $secret, 'json');

it will incorrectly format some requests by appending the ?format=json parameter.

For example, the LinkedIn docs say that to list all companies that a member is an admin for you must query "https://api.linkedin.com/v1/companies?format=json&is-company-admin=true". Using this package creates the following query "https://api.linkedin.com/v1/companies?format=json&is-company-admin=true?format=json"

post on LinkedIn wall error

I created a same function call like show in below example

 $linkedIn=new Happyr\LinkedIn\LinkedIn('app_id', 'app_secret');
  $linkedIn->setAccessToken('access_token_from_db');
  $options = array('json'=>
       array(
              'comment' => 'Im testing Happyr LinkedIn client! https://github.com/Happyr/LinkedIn-API-client',
        'visibility' => array(
        'code' => 'anyone'
         )
      ) 
   );
   $result = $linkedIn->post('v1/people/~/shares', $options);
   var_dump($result);

But when i print response .. Getting null data . My application has w_share access . I also tried adding scope during authorization.

Example in Readme is not working, User is not authenticated

Hi,

I am trying HappyR LinkedIn and provided the API Key and API Secret as mentioned in example in ReadMe. However upon checking this condition, both isAuthenticated and hasError return false.

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

exit();

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

Upon running the functions $linkedIn->getLoginUrl(), it returns following URL
"https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=75yufj9nyh5jzl&redirect_uri=http%3A%2F%2Frolustech.cosmoscrm.com%2Fapi%2Fsocial%2Flinkedin%2F5&state=cc3ca979cb9d1b0f062ceb11f6cabbee"

What else apart from App Key and App Secret is required to connect to LinkedIn?

How can I inject oauth2_access_token?

I have oauth2 access token and want to use to share on linkedin, can you please tell me how to do this?

I have both
OAuth User Token: "randomUserTokenGeneratedAtLinkedin"
OAuth User Secret: "randomUserSecretGeneratedAtLinkedin"

which and how to use it??

Error: Invalid Acces token

Hello,
My application allow user to connect to linkedin (using javascript) and I store access token that I got from IN.ENV.auth.oauth_token.
I would like to use this API to post to user's wall.
I have followed the instruction, but I got Invalid acces token error.
Did I use correct acces token? Any idea how to fix this error?

Thanks

Could not get access token

Fatal error: Uncaught Exception: Could not get access token thrown in C:\xampp\htdocs\linkdin\vendor\happyr\linkedin-api-client\src\LinkedIn.php on line 374

Guzzle v6, client error 403 on valid request

Hello,

I'm using the psr7 feature branch using Guzzle6.
I'm having issues running the following request:

$this->linkedIn->get('v1/companies', ['format' => 'json', 'query' => ['is-company-admin' => 'true']]);
// Same with:
$this->linkedIn->get('v1/companies', ['query' => ['is-company-admin' => 'true', 'format' => 'json',]]);

Which is returning a Client error: 403. Although when checking the built URL I have:

https://api.linkedin.com/v1/companies?is-company-admin=true&format=json

Which is working on apigee, with the exact same URL.

Am I missing something ?

Thank you,

Unauthorized access to group messages

Hey,

Great API client! I'm struggling with authorization on group messages.

  1. created a private group from http://www.linkedin.com/grp/ and posted some discussions as me
  2. login with linkedin using this code:
$url = $linkedIn->getLoginUrl(array(
                'scope' => array(
                    'r_basicprofile',
                    'w_messages',
                    'r_network',
                    'w_share',
                    'rw_groups',
                )
            ));
  1. access my group memberships (this works and correctly shows my newly created private group)
$api_result = $linkedIn->api('v1/people/~/group-memberships');
  1. try to read the group messages from my private group:
$api_result = $linkedIn->api('v1/groups/'.$linkedin_group_id.'/posts?order=recency&category=discussion');

results in Fatal error: Uncaught GuzzleException: 401: Client error response .... [status code] 401 [reason phrase] Unauthorized ...

However I can correctly call this API endpoint through the test console and it shows my test messages, the URL and all that seems correct. https://apigee.com/console/linkedin

Any ideas?

unable to get access code

this is my code to fetch the code.

$linkedin = new LinkedIn(env('LINKEDIN_KEY'), env('LINKEDID_SECRET'));
$linkedin->getAccessToken();

i changed getAccessTokenFromCode() in order to debug so when it throws the exception it returns $e and here is what i get.

LinkedInApiException {#309 ▼
#result: array:2 []
#message: "missing required parameters, includes an invalid parameter value, parameter more than once. : client_secret"
#code: 400
#file: "*/vendor/happyr/linkedin-api-client/src/Http/GuzzleRequest.php"
#line: 38
-trace: array:53 []
}

any ideas on how to debug or fix this issue? is it this code or guzzle?

Cannot get access token

Hi,

I am having trouble getting an access token. I tried debugging for a couple of days, but I can't trace the problem.

The URL gets constructed properly
/uas/oauth2/accessToken?grant_type=authorization_code&code=AQT9AFtORFRcPH58X_C0WAHhLgMOWFUPyl2M3fYMI7G7nKWwxmc9-Lbt2rV4B-M7xOaQBZ2VBz_MrreiiElVvqoLmQgtDKV1g5iq__2yvH_RIqgDjdU&redirect_uri=http%3A%2F%2Flocalhost%2Fwordpress%2Fafter-login%2F&client_id=&client_secret=

I run the URL through a browser and I get an access token

{"access_token":"AQWf5EQwQnL6592nV3uxByR4aGNktwwndsi8RCapwKIzIf9VE09V01D5Ge3Cyzrfprd0W3PscL-ASQYCLj3bLC5lH4JW7gVfX0u3iA5caunlNhFkM9FZ0EIXHe0v4T-0qK7Rok0OUQvJte-l0uk7lhcVMjwD-vAFx9azyykDSxoyuBXyWsg","expires_in":5100784}

But when I run it inside my code it throws an exception

Uncaught Exception: Could not get access token thrown in ...\LinkedIn-API-client-master\src\LinkedIn.php on line 374

Maybe you can point me in the right direction for debugging this.

Thank you

Marcelo

Can't retrieve string version of token for storage

I'd like to save the token to my db in order to use it for later authentication, but the token in AccessToken.php is private, and I can't convert it to a string for saving. I'd like to store the token and expiration, so, is there any way to do that with the library? Or, does this require a new function?

For the time being I made this addition in AccessToken.php, which seems to work fine. But, updates via composer will cause this change to be lost:

public function whatIsTheToken()
{
    return (string) $this->token;
}

Getting error after install php

Hi Team,

I have cloned this repository. After this i created sample php configuration file with my parameters

<?php

/**
 * This demonstrates how to authenticate with LinkedIn and send api requests
 */

/*
 * First you need to make sure you've used composers auto load. You have is probably 
 * already done this before. You usually don't bother..
 */
require_once "vendor/autoload.php";
//require_once "src/HappyR/LinkedIn/LinkedIn.php";

$linkedIn = new HappyR\LinkedIn\LinkedIn('mykey', 'mykey');

if ($linkedIn->isAuthenticated()) {
    //we know that the user is authenticated now. Start query the API
    $user=$linkedIn->api('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>";

After this when i open this file in browser i am getting error as

Fatal error: Call to a member function get() on a non-object in /usr/share/nginx/www/lnk/vendor/illuminate/support/Illuminate/Support/Facades/Facade.php on line 208

Can any one please help me to get this problem fixed

symfony2 Linkedin

Hello,

I try to use your bundle to post and get articles on the wall.
I use symfony2, and I make a service like your demo.

But I have a problem, when I try to authentificate and make a post the function isAuthentificated() is always at false.

This is my code:

Service:
linkedin:
class: WebSite\BackEndBundle\Services\LinkedInService
arguments: ['fakeapi', 'fakesecret', 'r_basicprofile,r_emailaddress']

 Controller function:

 private function publicationLinkedIn($title,$description)
{
    $linkedIn=$this->get('linkedin');

    if ($linkedIn->isAuthenticated()) {
        var_dump("authentification linkedin ok");
    }elseif ($linkedIn->hasError()) {
        echo "User canceled the login.";
        exit();
    }
    //var_dump($linkedIn);
    var_dump("fin publication linkedin");
}

$linkedIn->isAuthenticated() return always false, $linkedIn->hasError() never return error, and if I make a fake path apiid or secret, I have no error too, like the condition does not exist.

Maybe I don't use correctly your bundle, but I don't see where.

Thanks you for your help.

PS: My service is correctly load because $linkedIn=$this->get('linkedin'); return an object with apiId,secret and more.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.