Skip to content
This repository was archived by the owner on Nov 16, 2021. It is now read-only.
This repository was archived by the owner on Nov 16, 2021. It is now read-only.

Code examples for webhook authentication #2

@kueben

Description

@kueben

Hi, I am currently using the following to verify the X_Signature on the requests sent to our webhooks endpoint, however it is failing. I feel the documentation is not super clear on it, for instance does 'complete event payload' mean the payload part of the json object, or does it mean the full body of the request? Below is the code I am attempting to use at the moment however it is failing. If you could provide some example code or point out what I am doing wrong that would be great.

    import hashlib
    import hmac
    import base64
    # secret token as shown on the webhooks section of the dashboard
    key = bytes(ck, 'utf-8')
    
    # body = bytes(json.dumps(json.loads(body.decode())['payload']), 'utf-8')
    message = body # request.body

    digester = hmac.new(key=key, msg=message, digestmod=hashlib.sha3_224)

    signature = digester.digest()

    signature = base64.b64encode(signature).decode()

    return signature

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions