Oauth Access token not getting refreshed automatically

Hi Team,

Hope all are doing fine.

I would like to bring to your attention an issue related to our app that integrates Zoho CRM with Freshchat using OAuth. The app has been functioning smoothly; however, we have encountered a challenge when the access token received from Zoho expires after 1 hour.

Typically, the platform automatically refreshes the access token, ensuring uninterrupted functionality. Unfortunately, in this particular case, the token refresh process is not occurring as expected. Consequently, the app throws an error indicating an invalid access token and prompts users to reauthorize the app.

As you can imagine, reauthorizing the app every hour is not a practical or sustainable solution. Hence, I kindly request the assistance of the Marketplace team or the platform team to help us address this issue. We believe that with your expertise and guidance, we can implement a more efficient workaround or resolution.

Thank you for your attention to this matter. We appreciate your support in resolving this challenge and ensuring the seamless operation of our integrated app.

Best regards,
Jayanth

Hey @Jayanth_Kumar

I have a similar issue with having a connection to a service with client_credentials OAuth protocol.

In the end, I went building all by myself after having read this discussion Oauth method with client credentials flow

If you have a similar problem to solve, it may be the only solution for yourself too.

What I did is to store the access token with expiration date (time to live).
TTL is less than token expiration time, thus I know reliably when to refresh the token with the POST request to token service.

This works reliably and is not that much of an effort.

My app is serverless only, but if yours is frontend, you may think of adding a serverless component as sensitive access data may be shared (see discussion in the thread I shared).

Hope that helps already.
But I would love to see some “official” posting here aswell. Maybe my knowledge is outdated and client credentials flow is already supported anyhow (and if not, maybe if it will be in the future).

All the best,
Tom

1 Like

Hi @Jayanth_Kumar,

Can you share the OAuth configuration with sensitive details hidden and Zoho CRM OAuth documentation?

There might be additional parameters in third-party authorization vendors to enable automatic refreshing and if the refresh token is needed.
Were you able to check if the refresh token is received along with access token during local testing?

Hi @Raviraj ,

{
    "client_id": "",
    "client_secret": "<%= oauth_iparams.region == 'India' ? '': oauth_iparams.region == 'Europe' ? '' : '' %>",
    "authorize_url": "https://<%= oauth_iparams.region == 'China' ? 'accounts.zoho.com.cn' : 'accounts.zoho.com' %>/oauth/v2/auth",
    "token_url": "https://<%= oauth_iparams.region == 'India' ? 'accounts.zoho.in' : oauth_iparams.region == 'Europe' ? 'accounts.zoho.eu' : oauth_iparams.region == 'China' ? 'accounts.zoho.com.cn' : 'accounts.zoho.com' %>/oauth/v2/token",
    "token_type": "account",
    "options": {
        "scope": "ZohoCRM.modules.ALL,ZohoCRM.users.all,ZohoCRM.org.all,ZohoCRM.settings.all",
        "access_type": "offline",
        "response_type": "code"
    },
    "oauth_iparams": {
        "region": {
            "display_name": "Zoho CRM Data Centre",
            "description": "Please enter your Data Centre, Ex: US, India, Europe, China",
            "type": "text",
            "required": true
        }
    }
}

Can you also kindly help us in deploying a custom app for Freshchat , facing issues while doing so ,
I tried to modify the oauth_config for the newer custom app based on the below article

> Zoho-Refresh Token

Kindly help us with this.

@Jayanth_Kumar Looks like there’s another option that has to be used for Zoho CRM to generate the refresh token.

Please check this previous solution regarding the same if it works.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.