How to replace simple-koa-shopify-auth?

Not applicable

Hi. I used shopify-api@5, simple-koa-shopify-auth(createShopifyAuth, verifyRequest)

and I want to upgrade the version of shopify-api from 5 to 7.

 

my code is like this and it’s similar to the example code that exists on the page.

(https://github.com/TheSecurityDev/simple-koa-shopify-auth.)

 

server.use(
    createShopifyAuth({
      accessMode: "online",
      authPath: "/auth",
      async afterAuth(ctx) {
        const { shop } = ctx.state.shopify;
        const { host } = ctx.query;
        // Check if the app is installed
        // NOTE: You can replace with your own function to check if the shop is installed, or you can just remove it, but this is an extra check that can help prevent auth issues
        if (isShopActive(shop)) {
          // Redirect to app
          ctx.redirect(`/?shop=${shop}&host=${host}`);
        } else {
          // Redirect to installation endpoint to get permanent access token
          ctx.redirect(`/install/auth/?shop=${shop}&host=${host}`);
        }
      },
    })
  );

 

But This package only works with @Shopify/shopify-api v5.x. v6.x+ is not supported,

and I haven’t found any guides on how to replace koa-shopify-auth package and migration docs. 

 

How can I replace createShopifyAuth and verifyRequest? 
How can I replace simple-koa-shopify-auth(@shopify/koa-shopify-auth)?

Replies 0 (0)