A way to pass an existing app instance into @shopify/app-bridge-react's AppBridge provider. Something like:
const app = createApp( ... );
const apiClient = new ApolloClient({
link: new HttpLink({
credentials: "same-origin",
fetch: authenticatedFetch(app), // ensures that all requests triggered by the ApolloClient are authenticated
}),
cache: new InMemoryCache(),
});
ReactDOM.createRoot(root).render(
<Provider app={app}> {/* passing app instead of config here */}
<App />
</Provider>
);
The authenticatedFetch example given in Shopify Docs will not work with @shopify/app-bridge-react because there is no way to access the app instance.
Describe alternatives you've considered
I can use @shopify/app-bridge directly (no provider), but I'm afraid it will break my app
Describe the feature you’d like
A way to pass an existing
app
instance into@shopify/app-bridge-react
's AppBridge provider. Something like:The
authenticatedFetch
example given in Shopify Docs will not work with@shopify/app-bridge-react
because there is no way to access theapp
instance.Describe alternatives you've considered
I can use
@shopify/app-bridge
directly (no provider), but I'm afraid it will break my appAdditional context