Can't call API from application proxy - Automatically redirected to password page

William22
New Member
10 0 0

I have an authenticated app built on Rails, which is able to get information in the admin backend and display it. However, I want to be able to get this information on the frontend using an application proxy. When I try to access that information, I get redirected to myshop.myshopify.com/password. I think this page is basically a 404 page. My rails routes are setup correctly, however, because if I take out all API calls from my controller, that page will accurately display HTML from my view.

 

In the bigger picture, what I'm trying to do is dynamically create a product variant when a user does something like pushes a button on the product page. My idea for this was to place javascript on that page that calls my app proxy with Ajax. I read online somewhere that app proxies strip cookies from your app when they're loaded... Perhaps my app's authentication is being stripped. If this is the case, how would I go about achieving this functionality? I considered using webhooks, but none of the webhook events seemed to be close enough to my desired functionality.

 

Thanks for any tips. I'm using the shopify_app gem for authentication and have my app uploaded on Heroku.

 

github: https://github.com/WilliamNHarvey/ShopifyTestApp

0 Likes
josh_c2
Shopify Partner
1 0 0

Hey William,

I just ran into the same issue and managed to get past it so hopefully I can help you out. I took a look at your code but couldn't find the controller action that was handling the request for the proxy. Could you let me know where this happens?

Josh

0 Likes
HunkyBill
Shopify Expert
4435 40 477

App Proxy calls are just that. A Proxy. Shopify gathers up your POST or GET information and passes it to your App, providing authentication in the headers that the call is coming from Shopify. You are responsible for decoding the payload, and responding. 

So the first step you have to make it to get a Proxy request from Shopify to your endpoint. Once you acheive that minor glory, you can authenticate it. After that, the sky is the limit and you can carry on.

Note that Michael Hewson is currently placing a bunch of Pull Requests on the Shopify App gem so that you can benefit from all the mess involved being nicely packaged up like webhooks. 

So it matters not that you are on Heroku, or using the Shopify App gem, it matters more that you setup things correctly in the first place. not hitting your endpoint properly means you screwed up something in the setup in your App dashboard settings perhaps. 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
Cesar_Rodrigue2
Shopify Partner
3 0 0

But, can you give us an example of an API call from App Proxy?

 

0 Likes
mjmabato
New Member
9 0 0

are there any restriction for store with password page?

0 Likes