Rails: What is best way to use shopify api via thirdparty javascript??

Highlighted
Shopify Partner
2 0 0

I want to make app like Smile: Rewards & Loyalty.

I'm using Rails and shopify_app gem.

 

I embeded my script in theme.liquid

  <script id="storkwidget">
  (function(){
    var script = document.createElement('script');
    script.async = true;
    script.src='https://9d8792c0.ngrok.io/jsfile.js';
    var entry = document.getElementsByTagName('script')[0];
    entry.parentNode.insertBefore(script,entry);
    })();
  </script>

And I try to use ShopifyAPI in controller  inheriting ShopifyApp::AuthenticatedController.

But it always redirect to login page.

I understand the reason. This is because session[:shopify] is nil.

But I cannnot handle session[:shopify] unless editing gem.

What is best way to use shopify api via thirdparty javascript??

Using shopify_app gem is bad way??

 

0 Likes