asciisd / zoho

Zoho package for Laravel
36 stars 37 forks source link

"invalid_client" on oauth-callback #6

Closed stefnats closed 4 years ago

stefnats commented 4 years ago

Hi,

when generating the connection to Zoho CRM, i do the following steps:

  1. Create new Laravel Project (^8.0)
  2. composer require asciisd/zoho
  3. Fill out credentials in .env
  4. php artisan zoho:install
  5. php artisan zoho:authentication
  6. Login and click Accept
  7. Retrieve the following exception:
zcrmsdk\oauth\exception\ZohoOAuthException
zcrmsdk\oauth\exception\ZohoOAuthException Caused by:'Exception while fetching access token from grant token - HTTP/1.1 200 
 Server: ZGS
 Date: Thu, 01 Oct 2020 06:02:31 GMT
 Content-Type: application/json;charset=UTF-8
 Content-Length: 26
 Connection: keep-alive
 Set-Cookie: b266a5bf57=dcb92d0f99dd7421201f8dc746d54606; Path=/
 X-Content-Type-Options: nosniff
 X-XSS-Protection: 1
 Set-Cookie: iamcsr=3b99f999-eb8f-45eb-acf0-b6a2b0b878e4;path=/;SameSite=None;Secure;priority=high
 Set-Cookie: _zcsr_tmp=3b99f999-eb8f-45eb-acf0-b6a2b0b878e4;path=/;SameSite=Strict;Secure;priority=high
 X-Frame-Options: SAMEORIGIN
 Content-Language: en-US
 Strict-Transport-Security: max-age=63072000

 {"error":"invalid_client"}' in /home/250374/dbnynxpmbu/public_html/vendor/zohocrm/php-sdk/src/oauth/ZohoOAuthClient.php(69) #0 /home/250374/dbnynxpmbu/public_html/vendor/asciisd/zoho/src/Http/Controllers/ZohoController.php(17): zcrmsdk\oauth\ZohoOAuthClient->generateAccessToken('1000.8276d26dc4...') #1 [internal function]: Asciisd\Zoho\Http\Controllers\ZohoController->oauth2callback(Object(Asciisd\Zoho\Http\Requests\ZohoRedirectRequest)) #2 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array) #3 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('oauth2callback', Array) #4 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(255): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Asciisd\Zoho\Http\Controllers\ZohoController), 'oauth2callback') #5 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(197): Illuminate\Routing\Route->runController() #6 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(691): Illuminate\Routing\Route->run() #7 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #8 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #9 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(693): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #10 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(668): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request)) #11 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(634): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route)) #12 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(623): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request)) #13 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(166): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) #14 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request)) #15 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #16 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure)) #17 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #18 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure)) #19 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #20 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure)) #21 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(87): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #22 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure)) #23 /home/250374/dbnynxpmbu/public_html/vendor/fruitcake/laravel-cors/src/HandleCors.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #24 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure)) #25 /home/250374/dbnynxpmbu/public_html/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #26 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure)) #27 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #28 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(141): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #29 /home/250374/dbnynxpmbu/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request)) #30 /home/250374/dbnynxpmbu/public_html/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) #31 {main}

I'm using zoho.eu

Not sure what i'm doing wrong, can you help?

stefnats commented 4 years ago

Got it.

I needed to add to .env:

ZOHO_ACCOUNTS_URL=https://accounts.zoho.eu
ZOHO_API_BASE_URL=www.zohoapis.eu
ghost commented 4 years ago

Thanks for your contribution