Skip to content

Commit

Permalink
Merge pull request #145 from jason-engage/master
Browse files Browse the repository at this point in the history
Fix verifyRequest for urls containing array params
  • Loading branch information
gnikyt authored Jan 16, 2024
2 parents d49c319 + 90925d7 commit 86889b2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/BasicShopifyAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,14 @@ public function verifyRequest(array $params): bool
// Grab the HMAC, remove it from the params, then sort the params for hashing
$hmac = $params['hmac'];
unset($params['hmac']);

// Convert array values in the params to a string
foreach ($params as &$value) {
if (is_array($value)) {
$value = '["'.implode('", "', $value).'"]';
}
}

ksort($params);

// Encode and hash the params (without HMAC), add the API secret, and compare to the HMAC from params
Expand Down

1 comment on commit 86889b2

@jason-engage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice :)

Please sign in to comment.