reason to use Active_Shopify_Shops

reason to use Active_Shopify_Shops

mkamalkayani
Shopify Partner
87 8 16

I have used shopify-cli to bootstrap the app. In the server.js file the app uses `ACTIVE_SHOPIFY_SHOPS` object to verify if a session already exists,

I don't understand the need for this check, why not just check the session storage(Redis etc.) if a session exists and the session is not expired.

 

    router.get("/", async (ctx) => {
      const shop = ctx.query.shop;

      // This shop hasn't been seen yet, go through OAuth to create a session
      if (ACTIVE_SHOPIFY_SHOPS[shop] === undefined) {
        ctx.redirect(`/auth?shop=${shop}`);
      } else {
        await handleRequest(ctx);
      }
    });

 

 

Reply 1 (1)

mkamalkayani
Shopify Partner
87 8 16

I think I have found an answer here "https://github.com/Shopify/koa-shopify-auth/issues/71"

Sharing this incase someone else has same doubts.