Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

shopOrigin forceRedirect: true yet ngrok urls persist clientside

Solved

shopOrigin forceRedirect: true yet ngrok urls persist clientside

jenn11
Excursionist
33 4 7

I'm making a POST request in my dev shop: 

//data
const metafieldInput = {¬
  "metafield": {¬
    "namespace": "customProductMetafields",¬
    "key": "productDetails",¬
    "value": detail,¬
    "value_type": "json_string"¬
  }¬
};¬
//request
axios.post( '/admin/metafields.json', {¬
  metafieldInput¬
})¬
 .then(function (response) {¬
  console.log(response);¬
})¬
.catch(function (error) {¬
  console.log(error);¬
});

Yet the shopOrigin forceRedirect doesn't seem to be working, or I don't have it applied properly, because the request is sent to 123.ngrok.io and not store.myshopify.com. 

 

This is a development store with a public app. The setup was followed from the Create a Shopify App with React and Node provided by Shopify.Screen Shot 2019-10-29 at 3.07.07 PM.png

 

You are phoenix
Accepted Solution (1)

SBD_
Shopify Staff
1831 273 421

This is an accepted solution.

Hey @jenn11,

 

Force redirect detects if your app was loaded inside an iframe. If not, it will create a redirection back into the relative embedded URL in the Shopify admin.

 

To post the request to the myshopify url, you'll need to add the Shop to the URL like this.

Scott | Developer Advocate @ Shopify 

View solution in original post

Replies 3 (3)

jenn11
Excursionist
33 4 7

bumping as I'm still stumped on this.

You are phoenix

SBD_
Shopify Staff
1831 273 421

This is an accepted solution.

Hey @jenn11,

 

Force redirect detects if your app was loaded inside an iframe. If not, it will create a redirection back into the relative embedded URL in the Shopify admin.

 

To post the request to the myshopify url, you'll need to add the Shop to the URL like this.

Scott | Developer Advocate @ Shopify 

jenn11
Excursionist
33 4 7

Apologies for the delayed acceptance, I was learning out your answer 🙂

You are phoenix