api-auth-zoho
v1.0.22
Published
Designed to simplify Zoho API authorization
Readme
Zoho OAuth Code Generator
This is a simple code generator for initiating the Zoho OAuth 2.0 flow. You can use this to request an authorization code for Zoho API access.
Installation
There is no installation process required for this package. Simply include the code snippet within your project.
Usage
CommonJS
const getZohoAuthCode = require('./path/to/your/package.so'); // Replace with actual path
// Example usage
const scope = 'ZohoCRM.ALL'; // Replace with desired scope
const client_id = 'YOUR_ZOHO_CLIENT_ID';
const redirect_uri = 'YOUR_REDIRECT_URI';
getZohoAuthCode(scope, client_id, redirect_uri);How It Works
Initiates Zoho OAuth Flow:
ThegetZohoAuthCodefunction constructs a URL to initiate the Zoho OAuth 2.0 authorization flow.Redirects User:
The user's browser is redirected to Zoho's authorization page.User Authorization:
The user grants your application permission to access their Zoho data.Redirect to Redirect URI:
After authorization, Zoho redirects the user back to your specifiedredirect_uriwith an authorization code in the query string.
Parameters
scope (string, required):
A space-separated list of Zoho API permissions you're requesting. For example,ZohoCRM.ALLgrants full access to Zoho CRM.client_id (string, required):
Your Zoho application's unique client ID. This is essential for identifying your application to Zoho.redirect_uri (string, required):
The URL where Zoho will redirect the user after they authorize your application. This URL should be registered in your Zoho application settings.access_type (string, optional):
Specifies the type of access token you're requesting.offline(default): Requests a refresh token, allowing you to obtain new access tokens without user interaction.online: Requests a short-lived access token that expires after a certain period.
Additional Notes
Authorization Code:
The authorization code received in theredirect_uriis a temporary credential.Access Token:
You'll need to exchange this authorization code for an access token on your server-side.Access Token Usage:
The access token grants your application permission to interact with the Zoho API.Zoho Documentation:
Refer to Zoho's official documentation for detailed instructions on handling the authorization response and obtaining access tokens: Zoho API Documentation.
