Questions and discussions about using the Shopify CLI and Shopify-built libraries.
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);
}
});
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.