I started using the Shopify App Bridge in my new app. The app has the embedded properties enabled on the app setup.
When the app is successfully installed, it redirects correctly to the redirect url, but how do I go about forcing it to load the app embedded within the Shopify Admin UI. This is the case only during the app installation. If I open the app from the app list on the store admin, then it automatically loads correctly embedded within the Shopify Admin UI.
The documentation here (https://help.shopify.com/en/api/embedded-apps/app-bridge/initialization) indicates "The script detects if your app was loaded inside an iframe. If it wasn't, then the script creates a redirection back into the relative embedded URL in the Shopify admin".
But the above redirection doesn't seem to be happening. Anybody else have this issue?
Solved! Go to the solution
I just ran into the same issue. The solution for me was to pass set forceRedirect: true to createApp. This seems to be the only way it will redirect to the iframe, if you happen to open your app's URL directly at the top level.
createApp({ apiKey: '...', shopOrigin: '...', forceRedirect: true })
Did anyone else experience the same? if anyone from Shopify is looking into it, I would also suggest to update this part of the documentation.
Edit: It turns out that forceRedirect is false when running in development.
The forceRedirect true works for me as well.
Though the whole redirecting from shopify admin, to you app's url, then back to shopify admin, provides a super bad super experience, wouldn't you agree?
I agree, it's not the most seamless user experience, but it honestly hasn't been a source of complaints, for us. At least when the session is present, it usually loads the app in the iframe without any apparent redirects.
I think the restrictions imposed by Safari and iFrames are more annoying.
User | Count |
---|---|
9 | |
7 | |
5 | |
5 | |
5 |