Not able to refresh OAuth access token automatically

We are facing an issue related to the Freshdesk OAuth access token regeneration automatically. The APP does not authorize or perform OAuth 2.0 (third-party applications) .The issue is that the access token is expires in a certain period. We are regenerating it periodically but unfortunately the APP does not to regenerate the access token.

App ID and details: <shared via help@community.developers.freshworks.com>

Thanks!

Hi @Priya_Dharshini,

Could you share the following details to assess further?

  1. In the app, is it agent-based auth or account-based auth?
  2. The file contents of oauth_config.json file (pls hide/remove sensitive information like client id and secret)
  3. Documentation link to the third-party for OAuth
  4. Error messages received
  5. What is the expiration for the access token from the respective third-party resource owner?
  6. Does it require anything additional to refresh the token after the access token expiry?
1 Like
  1. In the app, is it agent-based auth or account-based auth? - account-based auth
  2. The file contents of oauth_config.json file (pls hide/remove sensitive information like client id and secret)- Shared in document
  3. Documentation link to the third-party for OAuth-Online Get Tickets API :Zoho Projects
  4. Error messages received- Shared in document
  5. What is the expiration for the access token from the respective third-party resource owner? - 1 hour
  6. Does it require anything additional to refresh the token after the access token expiry?

Thanks for the information, @Priya_Dharshini.

I have noticed that there are additional parameters from Zoho Projects documentation that can be passed to the auth URL that can provide a refresh token and skip the prompt next time. Did you try adding “access_type” and “prompt” parameters to “options” objects in the oauth_config.json file?

Hi,

We have performed the Oauth 2.0 in freshdesk with the third party integration. We are able to get the access token when we install the APP. After some time the access token expires. But the APP is not able to regenerate the access token automatically.

Third party integration link is in below,
https://www.zoho.com/projects/help/rest-api/get-tickets-api.html

Here I have attached the log details for your reference.

···

Thanks & Regards
Priyadharshini R

(Attachment new 2.txt is missing)

I went through the updated log. I see two errors:

First, it looks like Freshdesk API returns “Invalid OAuth access token”. (Here I assume you have masked the API key).

But then, after a short while, there is a template substitution error, which says the template received an undefined data-type.

However, I do not see anything in the log that says access token refresh failed. Maybe this is a separate request.

Given all of this, the only thing I can think of is either this is a local simulation issue in FDK. Or, the issue is with how iparams are being handled, which is resulting in the template substitution error.

@Priya_Dharshini can you share how you are handling iparams? (This shouldn’t make a difference, but I just want to be sure.)

1 Like

Hi @Raviraj ,

We have used that additional parameters in our code from Zoho. But still the issue is persist. Please have look On the attached screenshots.

Error Screenshot

Oauth file screenshot
Screenshot with oauth_config.json

@Priya_Dharshini I created a Zoho Projects account and tested it.

The refresh token is not being returned to the platform if the following parameters are not used in the configuration.

access_type=offline
prompt=consent

Could you check with the following configuration once?

  {
  "client_id": "<YOUR CLIENT ID>",
  "client_secret": "<YOUR CLIENT SECRET>",
  "authorize_url": "https://accounts.zoho.com/oauth/v2/auth",
  "token_url": "https://accounts.zoho.com/oauth/v2/token",
  "options": {
     "scope": "ZohoBugTracker.portals.READ,ZohoBugTracker.bugs.UPDATE,ZohoBugTracker.projects.READ,ZohoBugTracker.bugs.READ,ZohoBugTracker.bugs.CREATE,ZohoProjects.projects.ALL,ZohoProjects.portals.READ",
     "access_type": "offline",
     "prompt": "consent"
  },
  "token_type": "account"
 }

I’m yet to check if the refresh successfully happen. I will wait for an hour and confirm that.
But, I noticed refresh_token missing with your current app’s configuration which will definitely fail to refresh the access_token.

Just uninstall the app when you make any OAuth config changes and reinstall the app. We have to find if this is required for sure. But, anyway let’s try to reinstall this time.

3 Likes

I have tested the app after 1 hour after the above-mentioned change. Now, the app is able to refresh the token and works after the access_token expiry as well.

Please reinstall or reauthorize the app after this change and confirm if it works from your end as well.

Hi Raviraj,

Thanks for the support!

We have deployed the sample APP and observed the APP behavior full day today. It is working fine production.

1 Like

Sure, thanks for the confirmation!

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