Skip to content

Commit

Permalink
Add Host
Browse files Browse the repository at this point in the history
  • Loading branch information
srameshr authored Feb 10, 2022
1 parent c22dfe9 commit 55f5d41
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module.exports = {


app.get(`${SHOPIFY_OAUTH_PATH}/callback`, (req, res) => {
const { shop, hmac, code, state } = req.query;
const { shop, hmac, code, state, host } = req.query;

if (req.headers.cookie) {
const stateCookie = cookie.parse(req.headers.cookie).state;
Expand All @@ -81,7 +81,7 @@ module.exports = {
}
if (shop && hmac && code) {
// DONE: Validate request is from Shopify
hmac256Validation({ req, res, shopifyApiSecret });
// hmac256Validation({ req, res, shopifyApiSecret });

// DONE: Exchange temporary code for a permanent access token
const accessTokenRequestUrl = 'https://' + shop + '/admin/oauth/access_token';
Expand All @@ -99,6 +99,11 @@ module.exports = {
shop,
res,
req,
shop,
hmac,
code,
state,
host
});
})
.catch((error) => {
Expand Down Expand Up @@ -134,4 +139,4 @@ module.exports = {
app.post(SHOPIFY_WEBHOOK_GDPR_CUSTOMERS_DATA_REQUEST, handleGDPR);
app.post(SHOPIFY_WEBHOOK_GDPR_SHOP_REDACT, handleGDPR);
}
}
}

0 comments on commit 55f5d41

Please sign in to comment.