Closed Braunson closed 3 years ago
Is there a reason you are setting offline mode as your flow is not offline.
@tm1000 Yes this is for a server-side app that will retrieve i.e. a Deal record. Sorry new to using Zoho entirely.
I'm building a simple app to retrieve Deal information from the ZohoCRM based on an ID provided to it. I'm just generating this for the initial setup of the app to generate the refresh token.
The use-case is the user is sent an email with a URL where they can check the status of a deal in the system.
@tm1000 Yes I noticed that but it assumes you have the refresh token ahead of time, which I will not? Unless I'm not understanding it correctly
The documentation to get the refresh token is probably out of date.
(I deleted my previous message after I reviewed the readme)
There are other ways to get the refresh token outside of this module that can then be used in this module (away from computer atm or would share a bash script)
@tm1000 Ok, I would appreciate if you could share the bash script or the alternative ways when you get a chance 😃 I'm implementing the ZohoCrmApi
package now but also still stuck with the issue of the State error when trying to generate the refresh token.
Hi @Braunson You can use that code if you want to generate the code, but being offline you need to adjust it a little bit.
Specifically, you can skip the state
check part:
// Not necessary for you
if ($state !== $_GET['state']) {
throw new \Exception('Someone is tampering with the oauth2 request');
}
And also set the code
manually by copy-pasting it from the redirect url
$client->setGrantCode('YOUR_PASTED_IN_CODE");
Alternatively, you can still use the zoho way documented here: https://www.zoho.com/crm/developer/docs/api/v2/access-refresh.html
Using the example provided in the readme, I'm getting this error? I can confirm the states do differ when dumped. I am executing this code, getting redirected to the ZOHO permission screen, accepting and being redirected back to the same endpoint but with the state and code..
My code..