Created
July 13, 2020 02:39
-
-
Save ardeearam/57321792df831c7a6ce907dbfa9c055e to your computer and use it in GitHub Desktop.
Shopify Auth - Before Billing Code
This file contains hidden or 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" | |
| }); | |
| ctx.redirect("/"); | |
| } | |
| }) | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment