How to make network call to the app's backend from the checkout ui extension code?

How to make network call to the app's backend from the checkout ui extension code?

nitinpatel278
Shopify Partner
2 0 1

I've found this https://shopify.dev/apps/purchase-options/app-extensions/authenticate 

but it doesn't work for the new Checkout UI extensions. Any idea what is the way to get the access token for the app backend & make API calls from within the checkout UI extension? 

Founder of Checkout Custom Fields by Akia https://apps.shopify.com/checkout-custom-fields-1
Replies 2 (2)

abhishekthory
Shopify Partner
1 0 1
you can use 
  const sessionToken = useSessionToken();
for getting session token and then you have to put in header for as a Bearer token for request
jains
Shopify Partner
11 0 4

I am following this:

https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/react-hooks/sessions/usesessiontoken

 

But how do you digest the token and authenticate in your backend route? 
I am using Shopify Remix app template