App reviews, troubleshooting, and recommendations
I am trying to verify a Shopify webhook request for the topic orders/create, but the verification is returning False, I am not able to figure out the reason. Here's the code snippet I am using to verify the request.
class ShopifyWebhookOrderCreate(APIView): def post(self, request): verified = verify_webhook(request.body, request.META.get('HTTP_X_SHOPIFY_HMAC_SHA256')) if not verified: return Response(status=status.HTTP_401_UNAUTHORIZED) ... ... ...
and for verifying the request I am doing this:-
def verify_webhook(data, hmac_header): CLIENT_SECRET = config('SHOPIFY_CLIENT_SECRET') digest = hmac.new(CLIENT_SECRET.encode('utf-8'), data, digestmod=hashlib.sha256).digest() computed_hmac = base64.b64encode(digest) return hmac.compare_digest(computed_hmac, hmac_header.encode('utf-8'))
request.body format is b'{'the': 'data'}'
I verified the SECRET with the Shopify app.
Were you able to solve this? I'm having the same problem
my verify class is returning False. Not sure why.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024