Zendesk Webhook Authorization in Python



已于 2023年2月23日 发布

I am using following link as guide for me to authorize the api I am configuring in my Zendesk webhook:
https://developer.zendesk.com/documentation/event-connectors/webhooks/verifying/

and I am writing a code equivalent to the this function in python isValidSignature(signature, body, timestamp) but I am not able to get an hmac signature that is matching signature submitted to me in my headers :

def isValidSignature(signature, body, timestamp):
key = webHookSecret.encode('utf-8')
hmac_result = hmac.new(key, (timestamp+body).encode('utf-8'), hashlib.sha256)
hmac_result = hmac_result.digest()
if signature == str(base64.b64encode(hmac_result), 'utf-8'):
return True
else:
return False

Please advise what should I modify to fix this issue?


0

5

0 条评论

登录 to leave a comment.

找不到所需的内容?

新建帖子