title: Call Shopify API from App Proxy
body: <h1>Goal</h1>
  
  <p>I want to create a following app.</p>
  
  <p>Merchant selects 'top products' for each customer. These will be stored in my backend. </p>
  
  <p>For example:</p>
  
  <ul>
  <li>Customer A:  
  
  <ul>
  <li>Product X, variant 1</li>
  <li>Product Y, variant 3</li>
  </ul></li>
  <li>Customer B:
  
  <ul>
  <li>Product X, variant 2</li>
  <li>Product Z, variant 1</li>
  <li>Product W, variant 1</li>
  </ul></li>
  </ul>
  
  <p>The customer should then be able to login, go to a page in the store (e.g. <code>store.com/top_products</code>) and see their own 'top products'.</p>
  
  <h1>What I managed to do so far</h1>
  
  <p>I managed to deploy the rails Shopify app (<a href="https://github.com/Shopify/shopify_app" rel="nofollow noreferrer">https://github.com/Shopify/shopify_app</a>, which uses the shopify_api gem) to Heroku and connect it to my store. </p>
  
  <p>I also managed to setup the app proxy. I get the right response from the app for both the admin app page and the app proxy. </p>
  
  <p>Essentially my public app seems to work fine. </p>
  
  <h1>What I have to do now</h1>
  
  <p>I will have to call something like this in the app proxy:</p>
  
  <pre><code>ShopifyAPI::Product.find(:all, params: { limit: 10 })
  </code></pre>
  
  <p>However, this can be only called from <code>ShopifyApp::AuthenticatedController</code> (like in the admin app controller) and not <code>ShopifyApp::ApplicationController</code> (like in the proxy controller).</p>
  
  <p>So far I only managed to call the APIs and see the correct results from the admin dashboard of the store. </p>
  
  <p><strong>I cannot manage to call</strong> <code>ShopifyAPI::Product.find</code> <strong>from unauthenticated App Proxy.</strong></p>
  
  <p>Google doesn't really help me. 
  This is similar to my problem (has no solution though): <a href="https://ecommerce.shopify.com/c/shopify-discussion/t/how-to-connect-to-a-store-with-api-from-app-proxy-request-429417" rel="nofollow noreferrer">https://ecommerce.shopify.com/c/shopify-discussion/t/how-to-connect-to-a-store-with-api-from-app-proxy-request-429417</a></p>
  
  <h1>Question</h1>
  
  <ol>
  <li>What would be the best way to call the API from the App Proxy? </li>
  <li>Or how do I display some information on the store frontend using my
  backend which talks to the store's API? Is an app proxy the correct approach?</li>
  </ol>