How to force Shopify to stop embedding my app

kevin_mittal
Shopify Partner
10 0 7

Hello there,

 

I want to make sure that my Shopify application doesn't get embedded inside Shopify. I have already disabled "Embedded app" option inside extensions but sometime Shopify embeds it inside the dashboard.

 

Is there any way I can force Shopify to stop embedding my app?

 

Thanks.

Replies 6 (6)

copleykj
Excursionist
21 0 3

This seems strange.. I'm not sure why this would happen. As a temporary fix you could of course check to see if the app is loaded in an iframe, and then use the App Bridge or the Embedded app sdk to redirect..

 

 

 

if (window.location !== window.parent.location) {
app.dispatch(Redirect.toRemote({ url: location.href, }));
}

 

 

kevin_mittal
Shopify Partner
10 0 7

Thank you @copleykj for your solution. Unfortunately, this requires me to remove `X-Frame-Options: DENY` from my responses, otherwise the snippet you shared will never get executed.

 

I do not want to unset `X-Frame-Options: DENY` for various reasons.

 

Do you think there's some issue with Shopify Partners dashboard? Especially with the Extensions settings?

 

Thanks.

copleykj
Excursionist
21 0 3

I would say that if it's not something that you've missed on your end, then it must be some issue with Shopify. If you can't get an answer from staff here, it might be best to contact support. https://help.shopify.com/en/questions

iain-campbell
Shopify Staff (Retired)
54 9 23

Hi Kevin,

 

Check out the instructions on this page:

https://help.shopify.com/en/api/embedded-apps/app-bridge/initialization

 

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. You can disable this functionality by passing forceRedirect: false as a configuration option.

Are you using EASDK or App Bridge anywhere in your app?

To learn more visit the Shopify Help Center or the Community Blog.

kevin_mittal
Shopify Partner
10 0 7

Hello @iain-campbell 

 

No, I am not using app-bridge anywhere.

 

Furthermore, this is only happening if user hasn't logged into Shopify store before starting the OAuth process. So if user is visiting my app first and initiating OAuth from my app, it always loads my app inside iframe in dashboard.

 

😕

iain-campbell
Shopify Staff (Retired)
54 9 23

Hi Kevin,

 

Thanks for the additional info. Would you be able to link to your app here so we can try to reproduce the issue? You can also message me directly if you'd prefer.

To learn more visit the Shopify Help Center or the Community Blog.