How to Generate an Access Token in Zoho Creator Using a Simple Form
- Yuvaraj Kumar
- Dec 20, 2024
- 4 min read

In Zoho Creator, we’ll walk you through the process of generating an access token using a simple form, allowing you to streamline your workflow and enhance your application’s functionality, which helps the developer to ease the process to get the Access and Refresh token instantly without time consuming
Understand the Basics of Access Tokens in Zoho Creator
Before diving into the process, it’s important to understand what an access token is and how it works. An access token is a unique identifier that grants access to specific resources in your Zoho Creator application. It acts as a key to authenticate API requests, ensuring that only authorized users or systems can interact with your data.
Create a Simple Form for Access Token Generation
To generate an access token in Zoho Creator, you’ll need to create a simple form that will handle the process. This form will be used to capture the necessary details for authentication.
1. Navigate to Your Application: In Zoho Creator, go to the application you want to use.
2. Create a New Form: Click on the “+ New Form” button to create a new form.
3. Add Necessary Fields: The form should include fields such as:
o Client ID (from Zoho API Console)
o Client Secret (from Zoho API Console)
o Code (Generated Code using Zoho API Console)
o Domain (in, com, eu, com.au, jp)
o Generate Refresh Token
o Refresh Token
o Generate Access Token
o Access Token

Check out this link for a sample Access token generation form for reference,
If needed, Publish the form for public access to ensure it is available for everyone to use.
Obtain the Client ID, Client Secret and Code
Before you can generate an access token, you’ll need the Client ID and Client Secret from the Zoho API Console:
1. Go to the Zoho API Console.
2. Add Self Client
3. Once the OAuth client is created, you will receive your Client ID and Client Secret.
4. To Generate Code you need to Provide Scope, Time duration and Scope Description based on your application’s needs. Scope you’ll get Zoho API documentation based on the product like Zoho Books, Zoho Creator Etc…
Example for Scope based on Zoho Product
Zoho Creator Scopes :
ZohoCreator.form.CREATE,ZohoCreator.report.CREATE,ZohoCreator.report.READ,ZohoCreator.report.UPDATE,ZohoCreator.report.DELETE,ZohoCreator.meta.form.READ,ZohoCreator.meta.application.READ,ZohoCreator.dashboard.READ
Zoho People Scopes :
ZOHOPEOPLE.employee.ALL,ZOHOPEOPLE.forms.ALL,ZOHOPEOPLE.dashboard.ALL,ZOHOPEOPLE.automation.ALL,ZOHOPEOPLE.timetracker.ALL,ZOHOPEOPLE.attendance.ALL,ZOHOPEOPLE.leave.ALL
Zoho Books :
ZohoBooks.fullaccess.all
Zoho Payroll :
ZohoPayroll.payrollrun.Update
Zoho Expense :
ZohoExpense.fullaccess.ALL
Zoho CRM :
ZohoCRM.modules.ALL,ZohoCRM.settings.ALL,ZohoCRM.users.ALL,ZohoCRM.org.ALL,ZohoCRM.bulk.ALL,ZohoCRM.coql.READ,ZohoCRM.notifications.CREATE,ZohoCRM.notifications.READ
Zoho Projects :
ZohoProjects.projects.CREATE,ZohoProjects.projects.READ,ZohoProjects.portals.READ,ZohoProjects.projects.UPDATE,ZohoProjects.projects.DELETE
Zoho Desk :
Desk.tickets.CREATE,Desk.tickets.READ,Desk.contacts.CREATE,Desk.contacts.READ
5. Copy the Code, Client ID, Client Secret and paste into the form which you seen above
Implement the Token Generation Logic
Now that you have the necessary credentials, you can implement the logic to generate the access token. Use the Zoho Creator’s built-in scripting language, Deluge, to handle this. We can write the below script on User input of Generate Refresh Token field in the form.
Here’s a sample script to generate the access token & Refresh Token:
if( input.Generate_Refresh_Token is true)
{
url = "https://accounts.zoho." + input.Domain + "/oauth/v2/token?grant_type=authorization_code&client_id=" + input.Client_Id + "&client_secret=" + input.Client_Secret + "&code=" + input.Code;
res = postUrl(url,Map());
refre_token = res.get("refresh_token");
access_token = res.get("access_token");
check_refresh = refre_token.isEmpty();
if( check_refresh is true)
{
alert "Your code or domain is incorrect please check this";
}
if( check_refresh is false)
{
input.Refresh_Token = refre_token;
input.Access_Token = access_token;
}
}
This script sends a POST request to Zoho’s OAuth API to retrieve the access token and refresh token based on the provided client credentials. These tokens were then returned to their respective fields and can be used for further API interactions.
Refresh the Access Token (If Necessary)
Access tokens in Zoho Creator typically expire after a certain period. If your token expires, you’ll need to refresh it to continue making API requests. Using the Refresh Token which we generated earlier through above steps, we can get a new access token without requiring user reauthorization. We can write this script on User input of Generate Access Token field in the form. By Clicking Generate Access Token, we can get New Access token everytime using refresh token.
Here’s a sample script to refresh the access token:
if( input.Generate_Access_Token is true)
{
url = "https://accounts.zoho." + input.Domain + "/oauth/v2/token?refresh_token=" + input.Refresh_Token + "&client_id=" + input.Client_Id + "&client_secret=" + input.Client_Secret + "&grant_type=refresh_token";
res = postUrl(url,Map());
acess_token = res.get("access_token");
check_acess = acess_token.isEmpty();
if( check_acess is true)
{
alert "Please select correct domain name";
}
if( check_acess is false)
{
input.Access_Token = acess_token;
}
}
Notes:
You must have the Authorization Code obtained by the user logging in, which is a step outside Deluge (via Zoho's OAuth URL).
Ensure your Zoho Creator app has the appropriate scopes (permissions) configured when obtaining the access token for API access.
Conclusion
Generating an access token in Zoho Creator using a simple form is a straightforward process. By following the steps outlined in this guide, you can authenticate your API requests, integrate with other Zoho applications, and automate workflows more efficiently. Remember to secure your access token and handle token expiration with refresh mechanisms for seamless integration.
If you have any questions or need further assistance, feel free to leave a comment below.
コメント