OAuth redirect URI without query params

Hi Everyone,

We are working on an app to integrate Shopify with Freshchat. We are unable to do the authentication with Shopify to get the access token.

We checked the issue and found that the Shopify doesn’t support query params in redirect URI. But the redirect URI from Freshchat contains query params. Please refer to this article in the Shopify community on the same.

Please advice us on how to send OAuth redirect URI without query params from Freshchat.

Thanks,
Arshath

Hi Arshath,

I am able to install Shopify app ( marketplace-sample-apps/Freshworks-Samples/App-Development-Features/Advanced-Features/oauth2/shopify_oauth_app at master · freshworks/marketplace-sample-apps · GitHub ) in Freshchat by just modifying the manifest.json to make the product as Freshchat and placeholder as conversation_user_info. Can you post the redirect URI Shopify app is trying to redirect to? Ideally, it should be just https://oauth.freshdev.io/auth/callback. In Shopify Dashboard under the app, you should whitelist this URI ( including path ). Hope this helps you in solving the problem.

Hi @ManiDeepak_Vandrangi,

I have whitelisted the URI https://oauth.freshdev.io/auth/callback in Shopify.

The problem is OAuth request sent from Freshchat contains Redirect URI with query params.

If needed, I could share the zip file of the app to check from your end.

Thanks,
Arshath

Can you share the oauth request sent from Freshchat?

Hi @ManiDeepak_Vandrangi,

Please find the OAuth.json & OAuth URL to Shopify from Freshchat below,

oauth_config.json

{
"client_id": "thisissampleclientid",
"client_secret": "thisissampleclientsecret",
"authorize_url": "https://<%= oauth_iparams.domain %>.myshopify.com/admin/oauth/authorize",
"token_url": "https://<%= oauth_iparams.domain %>.myshopify.com/admin/oauth/access_token",
"options": {
	"scope": "write_orders,read_customers"
},
"token_type": "account",
"oauth_iparams": {
	"domain": {
		"display_name": "Shopify domain",
		"description": "Please enter your Shopify domain",
		"type": "text",
		"required": true
	  }
   }
}

URL - https://sample-store.myshopify.com/admin/oauth/authorize?client_id=thisissampleclientid&redirect_uri=http://localhost:10001/auth/callback?callback=http://localhost:10001/custom_configs?product=freshchat&product=freshchat&response_type=code&scope=write_orders,read_customers&state=71775216-1b76-465a-b6fe-4aa093eaea62

In Shopify, we have whitelisted - http://localhost:10001/auth/callback

But the redirect URI send from Freshchat is with the query params - http://localhost:10001/auth/callback?callback=http://localhost:10001/custom_configs?product=freshchat

Error message from Shopify is

Thanks,
Arshath

Hi,
It seems a recent change had went in which adds query parameters to callback URL in local testing alone. This had been mandated and had been the case for all the products.

Hi @ManiDeepak_Vandrangi,

Thanks for your update.

Ooops, this means we cannot do the OAuth process with Shopify.

Hi,
Can you try doing whitelisting the full URL in shopify and let us know if it worked? The whitelist must contain the exact redirect URI including query parameters is mentioned in the URL you mentioned. I forgot that this won’t work.

Hi @ManiDeepak_Vandrangi,

Yes, it works. I tried with - http://localhost:10001/auth/callback?callback=http://localhost:10001/custom_configs?product=freshchat&product=freshchat

It’s really strange, i tried like this before making this post. It didn’t worked that time. Now it works :upside_down_face:.

If it is the case, can you share us the full redirect_uri for both Production & Testing?

Thanks,
Arshath

Hi,
The query params are appended only during local testing. For production, there won’t be any query parameters.

1 Like

Hi,

So this means, we have to whitelist only this URL - https://oauth.freshdev.io/auth/callback on production?

Thanks,
Arshath

1 Like

Hi,
Yes. The mentioned URL is enough in production.

I had same problem and I am thankful to all of you guys for kind support. Issue is now resolved. Thanks once again

2 Likes