Skip to content

Webhook signature with php #403

@aurelienpiquet

Description

@aurelienpiquet

Hello, i can't get a way to get the same hash as you.

What is the "YOUR_APPLICATION_SECRET" ? I tryied with Client ID, Client Secret, Private App Access Code.

Your documentation specifies code in Ruby:
encoded_body = Base64.encode64(json_body) # assuming json_body comes from the request
OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha1"), YOUR_APPLICATION_SECRET, encoded_body)

Here is my code with php:

        $signature = $request->headers->get('X-Content-Signature');
        $data = chunk_split(base64_encode($request->getContent()), 60, "\n");
        $secret = 'YOUR_APPLICATION_SECRET'; 
        $hash = hash_hmac('sha1', $data, $secret);
       hash_equals($hash, $signature); // false

And still when i compare the hash and your signature, it's never equal.

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