Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation directions are incomplete. #11

Open
github-grabaz opened this issue Dec 31, 2022 · 11 comments
Open

Installation directions are incomplete. #11

github-grabaz opened this issue Dec 31, 2022 · 11 comments

Comments

@github-grabaz
Copy link

github-grabaz commented Dec 31, 2022

This is my first attempt using this package and I followed the instructions with no success. After trying to diagnose, I stumbled upon the artisan commands that aren't mentioned in the documentation.

After running "php artisan zoho:install" some things seemed to start working.

I am still uncertain of .env setting: ZOHO_TOKEN="Code Generated from last step". What other things I might be missing?

Would you update the instructions to include any missing installation steps?

Thanks

@github-grabaz
Copy link
Author

github-grabaz commented Jan 1, 2023

Additional testing shows things aren't working. The simplest example results in errors...

use Asciisd\Zoho\ZohoManager;
Route::get('/test', function () {
    $leads = ZohoManager::useModule('Leads');
    $lead = $leads->getRecord('2222290000053656001');  
    dd($lead);
});

Errors reported:

Typed property Asciisd\Zoho\ZohoManager::$module_api_name must not be accessed before initialization

Exception::__construct(): Passing null to parameter #1 ($message) of type string is deprecated in I:\www\laravel9_zoho\vendor\zohocrm\php-sdk-2.1\src\com\zoho\crm\api\exception\SDKException.php on line 42

@1337erik
Copy link

The instructions are very incomplete and confusing - i followed a youtube tutorial that itself was incomplete and combined what i learned from that to make this package work. I have a very successful integration working but it is mostly a wrapper around this package. Feel free to DM if you need help

@abbieben07
Copy link

@1337erik Please can you help me figure out the installation process. i can't seem to get a valid token.

@1337erik
Copy link

1337erik commented Feb 5, 2023

yeah, you need to go to https://api-console.zoho.com/ and create a self-client. The ENV vars that I have set are:
ZOHO_REDIRECT_URI="${APP_URL}/zoho/oauth2callback"
ZOHO_CURRENT_USER_EMAIL=
ZOHO_SCOPE_EXAMPLE=aaaserver.profile.READ,ZohoCRM.modules.ALL,ZohoCRM.settings.ALL,ZohoCRM.users.all
ZOHO_CLIENT_ID=
ZOHO_CLIENT_SECRET=
ZOHO_TOKEN=
ZOHO_DATACENTER=USDataCenter
ZOHO_SANDBOX=false

the scope example im pretty sure is not a real thing but i keep it there because i want an easy place i can copy/paste it from whenever i do the self-client.

when you create the self client, a token will appear in a pop-up modal that you copy/paste into ZOHO_TOKEN, then the next screen will have the client_id and client_secret.

then you do "php artisan zoho:grant" and it should tell you its successful

At that point you should be able to just do commands and they authenticate, I very very very rarely have to re-generate the token, seems to just refresh whenever i use it and i use it often. Im not sure if its important but i select "10 minutes" for the duration of the self-client.

At that point I basically use this package as a core API that I wrap around for the stuff that I need.

Let me know if that helps/doesnt help

@1337erik
Copy link

1337erik commented Feb 14, 2023

I also just learned while pushing to production that two apps cannot be using the self client at the same time.. better yet you cant create multiple Self Clients.. so it actually is necessary for staging/production servers to use a different client. I went to the API console in zoho and created a "Web Application Client", set the URL to my production site url ( must be spelled EXACTLY as is with https or http whichever you use ), the Redirect URI is the same production app url with "/zoho/oauth2callback" appended to the end.

You then copy/paste the Client ID and Client Secret, then this is where it gets wierd.. In the console of your production server you need to run "php artisan zoho:authentication" - the output will be a url that you then copy/paste into the browser that you log into the Zoho CRM with. This link will lead you to a place where you have to click "accept". This brought me to a 404 page - however that is fine. Inside the URL of that 404 page theres a query param named "token" - something like "https://websiteUrl.com/foo/bar?code=asdadadasdasdasda&otherParam=asdasdasd"

You need to copy/paste whatever is the value of that code param ( and ONLY that ) and paste it into the .env ZOHO_TOKEN

thats when you run "php artisan zoho:grant" and you should be good to go, worked for me!

@1337erik
Copy link

1337erik commented Feb 14, 2023

@aemaddin suddenly the refresh token is not working and the Server Api Client is not working anymore - it was running smoothly. The logs say

image

I noticed that the grant action is only really relevant for the self-client, and it seems like your old zoho package has instructions to setup the Server Api Client whereas this one encourages the Self Client..

Is there anything that was removed that can be added back to support the Server Api? I went through the vendor files and found some lines referencing a refresh token in the other package but nothing in the new one.

Its unrealistic to only use Self Client as only 1 application can use it at a time and zoho only allows creating 1 at all.

Let me know, thanks

I've tried running zoho:authentication a few times, even created a new Api Client.. nothing seems to work now

@1337erik 1337erik mentioned this issue Feb 15, 2023
@1337erik
Copy link

I think I figured it out - I cleared out the zcrm_oauthtokens.txt contents in the resourcePath ( look in zoho.config for your path ) and then re-initialized the server api toke and its working again.. I think when I had switched back to the self-client and back again to the server-application, I noticed that text file had references to my self-client client ID so it maybe acts as a cache.. so once i cleared it and re-initialized it seems to be working fine

@1337erik
Copy link

1337erik commented Apr 6, 2023

Still not working actually - this is the same issue as the most recent issue opened related to the Server-Client not storing/using the refresh token

@moses-ocho
Copy link

The instructions are very incomplete and confusing - i followed a youtube tutorial that itself was incomplete and combined what i learned from that to make this package work. I have a very successful integration working but it is mostly a wrapper around this package. Feel free to DM if you need help

Please can I get a step-by-step guide on how to make this work? I keep getting the same issue raise by @github-grabaz
Exception::__construct(): Passing null to parameter https://github.com/asciisd/zoho-v3/issues/1 ($message) of type string is deprecated in I:\www\laravel9_zoho\vendor\zohocrm\php-sdk-2.1\src\com\zoho\crm\api\exception\SDKException.php on line 42

@1337erik
Copy link

Follow the steps on my comment above from Feb 4th to setup a self client you should be working, any error outside of that would most likely be an issue with how you are sending data or processing data with the api and would require more indepth screenshots of context to debug

@amitdangwal
Copy link

Hi, Is this repo still in use. I see no changes/fixes added to this repo almost from a year. So I am wondering if this is still active or not.

The issues highighted by @1337erik , @github-grabaz are still appearing. On top I am getting below error when I try to search a Lead by ID. The API do fetches the Lead and I can see it coming in response but then later below error appears.

Undefined array key "com\zoho\crm\api\record\ResponseHandler"

Also, @1337erik were you able to make it work with Server-Client ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants