Invalid Redirect Uri in local testing

Hi,

I want to make an Oauth handshake with Zoho CRM, but I’m getting an error in local testing only. I have successfully made an Oauth handshake with Zoho CRM in the custom app. Now we are ready to submit our app to be published in the Freshworks Marketplace. Before submitting the app, we should complete the code coverage. So how can I make an Oauth handshake to obtain an access token in local testing?

Error message:
Invalid Redirect Uri
Redirect URI passed does not match with the one configured

I registered my app in the Zoho API Console like this to get client_id and cilent_secret.

oauth_config.json

 "client_id": "<%= oauth_iparams.client_id %>",
  "client_secret": "<%= oauth_iparams.client_secret %>",
  "authorize_url": "https://accounts.zoho.<%= oauth_iparams.region %>/oauth/v2/auth",
  "token_url": "https://accounts.zoho.<%= oauth_iparams.region %>/oauth/v2/token",
  "token_type": "account",
  "options": {
    "scope": "ZohoCRM.modules.ALL,ZohoCRM.settings.fields.ALL",
    "access_type": "offline",
    "prompt": "consent"
  }

I am looking forward to hearing from you.

Thank you

Hi @Kithiyon,

Some changes are made in the redirect URL that appends additional query parameters depending on which page the OAuth handshake is initiated from. The redirect URL must be updated with this query parameter for local testing.

Please refer to this topic for the changes required.

Thanks @Raviraj

I’m not able to enter the homepage URL and authorised redirect URIs in the Zoho API console like this:http://localhost:10001/auth/callback?callback=http://localhost:10001/custom_configs?product=freshdesk&product=freshdesk. If I enter the above URL, I’m getting an error from the Zoho API console.

So I tried this URL:

http://localhost:10001/auth/index?callback=http://localhost:10001/custom_configs?product=freshdesk

This URL was obtained while loading the Oauth Iparams page in the browser.By this url, I’ve successfully created the client_id and client_secreat in the Zoho API console, but I’m getting the same error while making an oauth handshake with Zoho.

Hi @Raviraj

Any updates about this?

@Kithiyon Due to some expectations in Freshworks Marketplace, the complete URL, as I have mentioned, is required to be redirected properly after the handshake.

So, can you please check with the Zoho console team on the solution for the error that happens while saving the complete URL?

Hi @Raviraj

After the discussion with the Zoho developer team, I sorted out the issue.

2 Likes

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