Shopify AppBridge update question

Hi all,

We have been trying to upgrade our AppBridge according to this doc but are running into an issue making authenticated calls on page load (where previously, we would rely on getSessionToken from app-bridge/utilities we now want to use shopify.idToken())

More context: we have two Shopify apps (one regular and one sales channel) that we manage. We have one deployment for both the apps, with a custom URL search param to help us determine whether to show UI for sales channel or show UI for the regular app – and so our application has add in the script tag for app-bridge with the appropriate API key element calculated at run time.

Due to this limitation, we’re not able guarantee that the shopify global will have appropriate config at page load – I did notice however that there’s also an id_token search param in the iframe embedded app URL, can we rely on that as a fallback value in cases where window.shopify is not yet defined?

On this point — generally — Yes!

Our API libraries + newer React Router App template and older Remix App template both use this (getSessionTokenFromUrlParam) as part of getting the session token / ID token, to perform OAuth Token exchange (implementation guide) to receive access tokens without requiring any browser redirects.

They also implement redirects to a “bounce page” as a fallback for if the session token is not present / valid.