cornernote
cornernote

Reputation: 1095

Can Shopify-App Admin URLs be used as endpoints for Ajax requests?

I am developing an app for shopify. The app will provide pages and functionality for the Shopify Admin area, specifically using App Bridge.

The app bridge URLs look like this:

https://[shop].myshopify.com/admin/apps/[my-app]/[my-path]

When you visit this page it loads shopify header/footer/menu, also an IFrame pointing to [my-path] on my site, for example:

https://example.com/[my-path]

I would like to setup Ajax requests using the same system of URLs. for example I would use the endpoint as follows (I know this one doesn't exist, just an example):

https://[shop].myshopify.com/admin/apps/proxy/[my-app]/[my-path]

Then instead of rendering the IFrame with my URL, Shopify admin would proxy the request, forwarding it to:

https://example.com/[my-path]

Is this possible, or do I have to send the Ajax request directly to my own server? If the later, how is it recommended I do authorisation? Can the HMAC that came in the original request be forwarded to the AJAX request (seems that would be bad, but not sure exactly why), or use a session that I establish on the original request?

Upvotes: 1

Views: 442

Answers (1)

David Lazar
David Lazar

Reputation: 11427

You setup an App Proxy in your App. You provide an endpoint in your App for the Proxy. Once this App is installed in a store, you can now call your App from the store itself, to the Proxy. Securely. That is the whole point of the App Proxy.

Upvotes: 0

Related Questions