Catalyst Connectors
A Catalyst Connector provides a seamless connection between Catalyst and an external Zoho service established through Zoho OAuth authentication. You can avail the use of a connector in your Catalyst application if your business logic includes the use of an external Zoho service’s API, such as a Zoho CRM or a Zoho WorkDrive API.
Catalyst handles the connection by storing the Access Token you generate in Zoho API console for a specific application in Catalyst Cache until its expiry. After it expires, the connector will automatically fetch a new Access Token using the Refresh Token and store it in the cache. Each time the Access Token expires, the connector automatically fetches and caches a new token in the background, relieving you from the efforts of constructing the logic to maintain an uninterrupted connection with the external Zoho service in your application’s business logic.
Before you configure the connector in your Node.js business logic as shown below, you will need to register a new client in the Zoho API console, and follow the steps to generate an Authorization Code and an Access Token for the first time. You can then configure the connector with the Refresh Token received, as well as other standard OAuth parameters such as the Client ID, Client Secret, Authentication URL, and Refresh URL that are required to refresh the Access Token automatically in a periodical manner. You can also incorporate your own logic in the connector based on your requirements.
- The name you provide for each connector in your logic must be unique.
- If you create a server-based application in the Zoho API console and you allow the access token to be created for different users within the same application, then you will need to provide a different and unique connector name for each user. This is because, when the same connector is used for different users in an application, the token will be overwritten on the same cache segment resulting in fetching the wrong user’s data from the external Zoho service.
The code below illustrates a Node.js connector. The promise returned here will be resolved to an access token string.
copyvar connector = app.connection({ ConnectorName: { client_id: '{add_client_id}', client_secret: '{add_client_secret}', auth_url: '{add_auth_url}', refresh_url: '{add_refresh_url}', refresh_token: '{add_refresh_token}' //Configure the OAuth params from the values returned after registering your app and generating authorization code in Zoho API console } }) .getConnector('{ConnectorName}'); //Provide a unique connector name for each connector you create connector.getAccessToken().then((accessToken) => { // Add your custom logic here });
Last Updated 2024-03-22 17:59:45 +0530 +0530
Yes
No
Send your feedback to us