Step 4: Refresh your Access Tokens
Access tokens expire after an hour of generation. To generate a new access token, use the refresh token you generated earlier.
You must use your domain-specific Zoho Accounts URL to refresh your access token.
For US: https://accounts.zoho.com
For EU: https://accounts.zoho.eu
For IN: https://accounts.zoho.in
For CN: https://accounts.zoho.com.cn
For AU: https://accounts.zoho.com.au
For JP: https://accounts.zoho.jp
Make a POST request with the following URL:
{Accounts_URL}/oauth/v2/token?refresh_token={refresh_token}&client_id={client_id}&client_secret={client_secret}&grant_type=refresh_token
- If the request is successful, you will receive the following output:
{
"access_token": "{new_access_token}",
"expires_in": 3600,
"api_domain": "https://www.zohoapis.com",
"token_type": "Bearer"
}
Note:
A "User" in an organization can have a maximum of 20 refresh tokens. And each refresh token can have a maximum of 30 active access tokens (non expired).
When a user creates a 31st access token, the system deletes the first created access token. Similarly, when the user creates the 21st refresh token, the system deletes the first created refresh token.
You can only generate a maximum of five refresh tokens in a minute.
We have provided with a sample test OAuth in all the examples, so that you can test any example on your own. You can replace the sample OAuth Token with your actual token to test requests from your Writer account.
- Here is avideo explaining how to refresh your access tokens.