Skip to content

Instantly share code, notes, and snippets.

@ardeearam
Created July 13, 2020 02:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ardeearam/92071062f3d852b8ba9aee7f78b840e7 to your computer and use it in GitHub Desktop.
Save ardeearam/92071062f3d852b8ba9aee7f78b840e7 to your computer and use it in GitHub Desktop.
Shopify Auth - After Billing Code
server.use(
createShopifyAuth({
apiKey: SHOPIFY_API_KEY,
secret: SHOPIFY_API_SECRET,
scopes: [SCOPES],
async afterAuth(ctx) {
//Auth token and shop available in session
//Redirect to shop upon auth
const { shop, accessToken } = ctx.session;
ctx.cookies.set("shopOrigin", shop, {
httpOnly: false,
secure: true,
sameSite: "none"
});
server.context.client = await handlers.createClient(shop, accessToken);
await handlers.getSubscriptionUrl(ctx);
}
})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment