Failed to execute 'postMessage' on 'DOMWindow' during app install

Hi,

i know this question has been raised before but none of the anwers helped.

I submitted app for approval and got this message preventing sumbittion:

  1. Correct your use of App Bridge using our documentation. Your OAuth redirect request fails to escape the iframe and doesn’t successfully direct to your embedded app’s version. However, your app does successfully use App Bridge from the installed apps list. Make your app’s embedded user interface experience consistent to comply with our embedded app requirements.

So my problem is that during installation process we’re not staying inside Shopify Admin constantly, we are going back and forth which is not consistent experience for the user.

We are loading permissions page (first step) correctly in an iframe. Meaning when our first enpoint is hit i redirect to Shopify permissions page via JS redirect e.g. window.location.assign = https://‘+shop+’/admin/oauth/authorize?client_id=‘+apiKey+’&scope=‘+permissions+’&redirect_uri=‘+redirectUri+’&state='+nonce

After that Shopify redirects to the url we specified and that’s where issues start.
When that endpoint is hit we want to generate a token, which we do, and redirect to another endpoint of ours.
When i do that redirect via JS or just normally redirect from server we do not stay embedded in Shopifies admin so thats why we couldn’t submit.

So i tried initializing and redirecting via appBridge, but then i get:
Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘https://shop-name.myshopify.com’) does not match the recipient window’s origin (‘https://my.domain.com’).

And thats it, i’m stuck, tried everytihng but cannot get it to work.

If i try to redirect to permissions url via appBridge i get this error also. But as JS redirect works and keeps us embedded in Shopifies admin so i’m not sure if its relevant or not.

Thanks in advance

Cheers

1 Like