tristanjahier / zoho-crm-php

An API client for Zoho CRM, written in PHP.
MIT License
23 stars 12 forks source link

Fails when trying to refresh access token #9

Open Mexidense opened 3 years ago

Mexidense commented 3 years ago

Hello @tristanjahier !

I hope everything is gone well!

I'm using this hash commit for versioning the package: "tristanjahier/zoho-crm-php": "dev-v2-support#67f2e5fa310a29381f0581a04e8a84880ef24e59",

I've noticed on my app the following exception when it tries to refresh the token: ErrorException: Undefined index: expires_in

Trace:

ErrorException: Undefined index: expires_in
1
File "/var/www/html/vendor/tristanjahier/zoho-crm-php/src/V2/Client.php", line 319
2
File "/var/www/html/vendor/tristanjahier/zoho-crm-php/src/V2/Client.php", line 319 in Illuminate\Foundation\Bootstrap\HandleExceptions::handleError [args]
3
File "/var/www/html/app/Providers/ZohoServiceProvider.php", line 32 in Zoho\Crm\V2\Client::refreshAccessToken
+7 non-project frames
11
File "/var/www/html/app/Services/ZohoService.php", line 39 in app [args]
12
File "/var/www/html/app/Services/ZohoService.php", line 34 in App\Services\ZohoService::buildClient

Do you know what's happening?

Thank in advance 🙏🏽

tristanjahier commented 3 years ago

From what I have observed myself, it happens from time to time. It happened to one of my application a couple of times recently too (8th and 11th of February)...

I have no explanation for that unfortunately. It is probably Zoho's API failing because it happens very randomly. And even if Zoho refuses to refresh your access token for valid reasons, the HTTP response status code should not be 200, and then Guzzle (which is the underlying HTTP client of this library) would throw an exception. And we would not have this issue anyway.

Can you confirm that it is not a recurring issue for you neither?