php-shopify icon indicating copy to clipboard operation
php-shopify copied to clipboard

md5($realHmac) === md5($hmac) always returns false

Open EmiliaCmn opened this issue 4 years ago • 1 comments

Hello!

I have a Shopify Custom App and i'm trying to use this library for authentication. Whenever i reach AuthHelper->verifyShopifyRequest() it's always comparing two different values and it will fail with error "This request is not initiated from a valid shopify shop!"

//hash the values before comparing (to prevent time attack)
if(md5($realHmac) === md5($hmac)) {

Would appreciate some help. Thanks!

EmiliaCmn avatar Apr 15 '21 08:04 EmiliaCmn

I had a similar issue and it was actually due to my friendly URLs. A parameter of "file" was passed into every page, but using htaccess hidden. I needed to update the "buildQueryString" function in the AuthHelper.php file to exclude this parameter. Do some debugging and check what URL buildQueryString is retruning to see if it matches yours.

Kehza avatar May 07 '21 09:05 Kehza