After the client application is authorized, OAuth access and refresh tokens can be used for making subsequent data requests to Zoho Desk. Therefore, the tokens must be persisted by the application.
You can achieve this persistence by writing an implementation of the predefined ZohoPersistenceHandler interface, which has the following callback methods:
The Zoho Desk Java SDK supports two types of persistence by default: file persistence and database persistence.
We have created a sample of each persistence implementation using the ZohoPersistenceHandler interface and included the link to access them in the sections below. The sample code is primarily for your reference and is not suited for use in large-scale applications. However, if you want to use the sample code in your application, you can do so by making the modifications required.
The ZohoOAuthFilePersistence class uses a file to write and read data from OAuth tokens. If you choose this way, make sure to also provide the following attributes and their corresponding values in the property file:
To access the sample implementation of ZohoOAuthFilePersistence click here.
This method of persistence uses a custom MySQL persistence. When you first invoke a function in the ZohoOAuthDBPersistence class, tables for oauthtokens will be created in the zohooauth database.
If you choose to use ZohoOAuthDBPersistence, you need to provide the following attributes and values in the property file: