How to access Custom App API from Theme App extension ?

nextuple
Shopify Partner
3 0 3

Created a Custom App and Theme App extension -> App Block
Configured the App Proxy
Trying to make API call from App Block ( app.js ) to the Custom App backend (Node) API.

The API calls are returning 302/304 status codes

Following error is shown on Custom App terminal

2023-01-18 13:53:48 | backend | [shopify-app/INFO] Running validateAuthenticatedSession
2023-01-18 13:53:48 | backend | [shopify-app/INFO] Session was not valid. Redirecting to /api/auth?shop=nextuple.myshopify.com | {shop: nextuple.myshopify.com}
2023-01-18 13:53:48 | backend | [shopify-api/ERROR] Missing Authorization header, was the request made with authenticatedFetch? | {isOnline: false}

How to get the authentication token from Theme App Extension( App Block app.js ) ?

Replies 3 (3)

Dzonotonas
Shopify Partner
12 1 7

Hi, maybe do you find a solution?:)

hashcode_io
Shopify Partner
90 3 8

@nextuple 


1. your app has checking the every request is authenticated. 
2. your malware or any app logic also checking the app proxy request is authenticated.
(Solution ). So you need to pass the auth token from app.js that was out side from the app. so you need a custom your app logs to validate the authenticated request.
debuging hits -  all the your request goes to app auth flow you can check with app  debug log.

 

Sm

Mohit_garg
Shopify Partner
15 0 1

do you find solution I am getting same error