Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

Session Token not resolved in localhost

ssmellow
Shopify Partner
7 0 0

While developing Shopify Embedded app locally, session token is not resolved.
I'm using ngrok as per guides in Shopify.

 

My app initialize:

  const [appBridgeConfig] = useState(() => {
      const host = btoa('xxx.eu.ngrok.io/')
    window.__SHOPIFY_DEV_HOST = host;

    return {
      host,
      apiKey: process.env.CLIENT_ID,
      forceRedirect: false,
    };
  });

 Same host is in Partners Dashboard. Using `authenticatedFetch` function:

export function useAuthenticatedFetch() {
    const app = useAppBridge();
    const fetchFunction = authenticatedFetch(app);

    return async (uri, options) => {
        const response = await fetchFunction(uri, options);
        console.log('Waiting');
        checkHeadersForReauthorization(response.headers, app);
        return response;
    };
}

And nothing is printed in console after `fetchFunction` . While using Demo store for app testing - it works like a charm. Packages:

 

  "@shopify/app-bridge": "^3.7.2",
  "@shopify/app-bridge-react": "^3.7.2",
  "@shopify/app-bridge-utils": "^3.5.1",

 

Replies 2 (2)

ShopifyDevSup
Shopify Staff
1244 201 440

Hi @ssmellow 👋 Issues with App Bridge can be submitted directly in the repo here.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

ssmellow
Shopify Partner
7 0 0

Already did that, want to get help everywhere, because stuck for a week with it.