App send to url instead to load in iframe

TroubledDev
Shopify Partner
1 0 0

I'm doing a public app, but I get stuck in the same problem.
When I install the app in my dev store to test, the Oauth flow seems to broke, starts fine, but when it's supossed to send me to my embbeded app, inside Shopify admin, it redirects me to the url app, at least for a second, before sending correctly to the iframe

I'm using de boilerplate for React + Node + AppBridge from Shopify cli, and honestly, can't see wheres the error.

Before the Oauth, I send this, just like this tutorial saids:

 

 

 <script src="https://unpkg.com/@shopify/app-bridge@2"></script>
      <script>
      document.addEventListener('DOMContentLoaded', function () {
        var redirectUri = 'https://${hostName}/auth/callback'
        var permissionURL = 'https://${shop}/admin/oauth/authorize?client_id=${apiKey}&scope=${scopes}&redirect_uri='+ redirectUri;

          if (window.top == window.self) {
            window.location.assign(permissionURL);
          } else {
            var AppBridge = window['app-bridge'];
            var createApp = AppBridge.default;
            var Redirect = AppBridge.actions.Redirect;

            const app = createApp({
              apiKey: '${apiKey}',
              shopOrigin: '${shop}',
              host: '${host}'
            });
            Redirect.create(app).dispatch(Redirect.Action.REMOTE, permissionURL);
          }
        });
      </script>

 

 

Any help will be appeciated.

Replies 0 (0)