How to authenticate embedded app backend

boolangery
Tourist
15 0 1

Hi,

I have an embedded app in react served with a nextjs / koa server. I would like to make request from this embedded app to my django backend.

 

I would like to pass though my app proxy to authenticate every request made on my backend.

 

I can't figure out how to make a request from my react frontend to my app proxy.

 

I tried the following:

 

fetch("/apps/my-app/my-api") 

When I do this I get :

GET https://e080523a.ngrok.io/apps/my-app/my-api 404 (Not Found)

And when I fetch on:

fetch("myshop.shopify.com/apps/my-app/my-api") 

I get a Cors error.

 

 

0 Likes
SBD_
Shopify Staff
Shopify Staff
1071 143 189

Hey @boolangery,

 

App proxies are for the online store, not embedded apps. Given your embedded app is hosted on a different domain to the store, this explains the CORS issue. 

 

Try skipping proxies all together and send the request directly to your server.

0 Likes
NagoyaDev
Tourist
7 0 0

I am trying to do something similar but am having trouble understand how to do it.

 

I was able to make the call to my shopify app with fetch by ignoring CORS, but I get back a wall of text. When checking routes with POSTMAN I see that that it will try to route me to a login page to sign in but of course I want to automatically bypass that to reach my app API and get the data I need.

0 Likes