Ecommerce Shopify WordPress Discussion

PHP Shopify App redirect_uri "Oauth error invalid_request: The redirect_uri is not whitelisted" Issue

I am facing an issue where the app works fine in local environment. However, when I deployed the shopify app on fly.io, I started facing an issue: "Oauth error invalid_request: The redirect_uri is not whitelisted" I have created an endpoint which takes shopname as parameter and I use that to install my public application on any store. It should work as the app is public and deployed on Fly.io Details of the endpoint: Route::get('/api/install/clipjoy', function (Request $request) { $shop = Utils::sanitizeShopDomain($request->query('shop')); $encodedRedirect = urlencode("https://clipjoy.fly.dev/api/shopify/redirect"); header("Location: "."https://$shop/admin/oauth/authorize?client_id=$client_id&scope=write_products,read_orders,write_publications,read_publications,read_themes&redirect_uri=$encodedRedirect"); exit(); }); I call installApp function on the /api/shopify/redirect hit. Detail of /api/shopify/redirect endpoint: public function installApp(Request $request) { $response = Http::post('https://'.$request->get('shop').'/admin/oauth/access_token?client_id=$client_id&client_secret=$client_secret='.$request->get('code')); return redirect(Utils::getEmbeddedAppUrl($request->query("host", null))); } client_id and client_secret keys are placed correctly and verified already. I have added /api/shopify/redirect as well in the Allowed redirection URL(s). However, after the user app permission approval screen, the app home page shows up for a couple of seconds and then "Oauth error invalid_request: The redirect_uri is not whitelisted" issue occurs. When I see the network calls, I can see I get 400 error on /admin/oauth/authorize call. In addition to this, in the call redirect_uri updates to "https://not_defined/api/auth/callback".
Have you added the fly.io app URL to the Shopify application "Allowed redirection URL(s)" inside the App Setup?

December 30, 2023

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.