Hi,
I have deployed my shopify app on Fly.io. The backend is based on PHP template. Everything works fine on local but once the app is deployed to Fly.io and https://clipjoy.fly.dev/?embedded=1&hmac=&host=&locale=en-PK&session=&shop=sample-test-app-123.myshopify.com×tamp= is hit, it basically returns ‘not_defined/ExitIframe’ url.
Background Information:
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.
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”.