Created
July 13, 2020 02:42
-
-
Save ardeearam/92071062f3d852b8ba9aee7f78b840e7 to your computer and use it in GitHub Desktop.
Shopify Auth - After Billing Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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