asciisd / zoho

Zoho package for Laravel
36 stars 37 forks source link

invalid client on auth callback #18

Closed asifaecor closed 3 years ago

asifaecor commented 3 years ago

""" HTTP/1.1 200 Server: ZGS Date: Tue, 22 Jun 2021 14:19:23 GMT Content-Type: application/json;charset=UTF-8 Content-Length: 26 Connection: keep-alive Set-Cookie: b266a5bf57=a711b6da0e6cbadb5e254290f114a026; Path=/ X-Content-Type-Options: nosniff X-XSS-Protection: 1 Set-Cookie: iamcsr=bde7fa44-9132-456b-be73-323907eaca6e;path=/;SameSite=None;Secure;priority=high Set-Cookie: _zcsr_tmp=bde7fa44-9132-456b-be73-323907eaca6e;path=/;SameSite=Strict;Secure;priority=high X-Frame-Options: SAMEORIGIN Content-Language: en-US Strict-Transport-Security: max-age=63072000

{"error":"invalid_client"} """

I already pass following data to .env file still get above error

ZOHO_CLIENT_ID= ZOHO_CLIENT_SECRET= ZOHO_REDIRECT_URI= ZOHO_CURRENT_USER_EMAIL= ZOHO_ACCOUNTS_URL= ZOHO_API_BASE_URL=

asifaecor commented 3 years ago

The solution to this is quite simple. If you normally log into the CRM with a domain other than .com, then setting the Domain connection property to the appropriate value should suffice. For example, if you normally log in with a .eu domain, then setting the Domain connection property to "eu" will cause the driver to use "https://accounts.zoho.eu/oauth/v2/auth" and "https://accounts.zoho.eu/oauth/v2/token" for the authorization and access token stages respectively. At that point, the same client ID should be considered valid for both stages of the OAuth flow, allowing you to obtain an access token and view your Zoho CRM data.