Open stephenvicino opened 7 years ago
Interesting.
I've tried to reproduce this but failed. What does your composer.json look like?
Can you provide a stack trace?
Who is trying to call GuzzleHttp\Client::sendAsync()
?
Full Error Message:
Fatal error: Call to undefined method GuzzleHttp\Client::sendAsync() in /var/www/includes/vendor/php-http/guzzle6-adapter/src/Client.php on line 64
My Composer.json: "league/csv": "~7.1", "aws/aws-sdk-php": "^3.0", "mandrill/mandrill": "1.0.", "mixpanel/mixpanel-php" : "2.", "stripe/stripe-php": "3.", "abraham/twitteroauth": "^0.6.2", "pusher/pusher-php-server": "^2.2", "smalot/pdfparser": "^0.9.25", "eventviva/php-image-resize": "1.5.", "hashids/hashids": "^1.0", "spatie/pdf-to-image": "^1.1", "nojimage/twitter-text-php": "^1.1", "twilio/sdk": "^4.10", "lusitanian/oauth": "^0.8.9", "thomaswelton/gravatarlib": "^0.1.0", "vinelab/rss": "^1.0", "php-ffmpeg/php-ffmpeg": "^0.6.1", "php-http/curl-client": "^1.6", "guzzlehttp/psr7": "^1.3", "php-http/message": "^1.4", "happyr/linkedin-api-client": "^1.0", "php-http/guzzle6-adapter": "^1.1"
This is the call that is failing: $user=$linkedIn->get('v1/people/~:(firstName,lastName)');
It generates the getLoginUrl() fine.
That is very strange. It looks alright, I tried to reproduce but I still cant..
Can you show me the output of:
composer show -i
(If you want to be more private it may be okey by:)
composer show -i | grep guzzle
You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages. guzzlehttp/guzzle 6.2.2 Guzzle is a PHP HTTP client library guzzlehttp/promises 1.3.0 Guzzle promises library guzzlehttp/psr7 1.3.1 PSR-7 message implementation php-http/guzzle6-adapter v1.1.1 Guzzle 6 HTTP Adapter
It looks like you got all the proper versions and everything is fine.. Do you use the composer autoloader?
Do you have the same issues when you use the curl client?
I am unsure if this is related, but somehow I am getting a new error message:
Catchable fatal error: Method Happyr\LinkedIn\AccessToken::__toString() must return a string value in /vendor/happyr/linkedin-api-client/src/LinkedIn.php on line 111
I tracked it down to this I believe: [__PHP_Incomplete_Class_Name] => Happyr\LinkedIn\AccessToken
That is unrelated. But also strange.
What PHP version do you run?
PHP Version 5.5.9-1ubuntu4.20
Ok, I got past the Guzzle error by just removing everything but your project and dependencies. I will try to narrow it down to see what package is causing it, however I am stuck on the other error now.
Ok, this combination works: "guzzlehttp/guzzle": "^6.2", "php-http/curl-client": "^1.6", "guzzlehttp/psr7": "^1.3", "php-http/message": "^1.4", "happyr/linkedin-api-client": "^1.0"
That's what you had before, right? https://github.com/Happyr/LinkedIn-API-client/issues/133#issuecomment-265195092
Minus the php-http/guzzle6-adapter v1.1.1 Guzzle 6 HTTP Adapter
Okey, so now you are using the Curl client, right?
Yes, not setting the http client
I reinstalled the guzzle6 adapter and am using Guzzle now,
However I can't get past the
Method Happyr\LinkedIn\AccessToken::__toString() must return a string value
error now.
Can you debug this line: https://github.com/Happyr/LinkedIn-API-client/blob/master/src/AccessToken.php#L42
And tell me what $this->token is before we print it?
Sure thing;
$this->token has the following value PHP_Incomplete_Class Object ( [PHP_Incomplete_Class_Name] => Happyr\LinkedIn\AccessToken [token:Happyr\LinkedIn\AccessToken:private] => I REMOVED THE ACCESS TOKEN [expiresAt:Happyr\LinkedIn\AccessToken:private] => DateTime Object ( [date] => 2017-02-04 10:48:59 [timezone_type] => 3 [timezone] => America/New_York )
)
Can you try this branch to see if I fixed your problems: https://github.com/Happyr/LinkedIn-API-client/tree/issue-133
(You may have to clear your browser cookies)
composer require happyr/linkedin-api-client:dev-issue-133
It worked on first load, then I refreshed the page and got the same error message bout toString
Thank you for helping me debug this. I've never been able to reproduce this issue. I've push another change to that branch. Would you mind giving it another try?
Still getting the error after call back,
Whats the correct way to get the access token after authenticating LinkedIn?
That is strange... Can you debug how that value comes in to $this->token
in the first place?
So it works the first time, but its gets stored in the session as an incomplete Object.
Okey, I've pushed a change now where I serialize the access token before we store it
Actual Behavior
Fatal error: Call to undefined method GuzzleHttp\Client::sendAsync()
Expected Behavior
Oauth
Steps to Reproduce
When I click the login URL, I get the error: Fatal error: Call to undefined method GuzzleHttp\Client::sendAsync()