Questions and discussions about using the Shopify CLI and Shopify-built libraries.
I'm trying to upgrade our APP to session token, and followed this video tutorials: https://www.youtube.com/watch?v=Vq0aWTaJDAY , I'm using the latest shopify CLI to create a node app, and want to see how the session token works. I changed the sample code a little bit according to the video
function MyProvider(props) {
const app = useAppBridge();
// codes I added here to get token
getSessionToken(app).then(token => {
console.log("token:", token)
})
const client = new ApolloClient({
fetch: userLoggedInFetch(app),
fetchOptions: {
credentials: "include",
},
});
const Component = props.Component;
return (
<ApolloProvider client={client}>
<Component {...props} />
</ApolloProvider>
);
}
But it return the error below, anything is wrong? The app url is set up correctly.