I want to call rest api in the shopify embedded app, how can i get the access token in the react?

New Member
4 0 0

I am following this tutorial to build an app: https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react


I want to query the abandoned checkout, so I think I should use rest api instead of grapql.
However I don't know how tot get the access token in the react component.
Can somebody tell me how to do this?

New Member
1 0 2

You can use `shop` and `accessToken` from `ctx`

  router.get("/products", async (ctx) => {
    const { shop, accessToken } = ctx.session;
    const res = await fetch(
      `https://${SHOPIFY_API_KEY}:${accessToken}@${shop}/admin/api/2020-10/products.json?${new URLSearchParams(
    ctx.body = await res.json();
    ctx.status = 200;


And make a call in React Component


const product = async (limit, sinceId) => {
    const res = await fetch(
      "/products?" +
        new URLSearchParams({
          since_id: sinceId,
    return await res.json();