How to force Shopify to stop embedding my app

Highlighted
Shopify Partner
8 0 1

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.

0 Likes
Tourist
20 0 0

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, }));
}

 

 

0 Likes
Shopify Partner
8 0 1

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.

0 Likes
Tourist
20 0 0

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

0 Likes
Shopify Staff
Shopify Staff
21 3 6

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?

0 Likes
Shopify Partner
8 0 1

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.

 

:/

0 Likes
Shopify Staff
Shopify Staff
21 3 6

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.

0 Likes