Can't get a session token from official node app sample

Pengyi
Tourist
6 0 0

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.

截屏2021-10-19_下午10_44_49__2_.png

Replies 0 (0)