Force the App to Embed within the Shopify Admin UI when using the new Shopify App Bridge

Solved
Highlighted
Shopify Partner
9 3 2

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?

0 Likes
Shopify Partner
9 3 2

Just an update on my question. The redirection does work correctly when using Embedded SDK, but doesn't redirect correctly with the App Bridge. Is someone having the same issue?

0 Likes

Success.

Shopify Partner
9 3 2

Looks like this is now fixed. Is working fine now.

0 Likes
Excursionist
21 0 5

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.

0 Likes
New Member
8 0 0

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?

Just trying to help out.

We are web app developers, SEO ethousiasts, and do all kinds of other cool internet things.
Check us out at https://public-apps.com
0 Likes
Excursionist
21 0 5

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.

0 Likes