Skip to content

Always showed Intent to receive required on Xero Webhooks and not x-xero-signature header not matched #240

@MJunaidIqbaal

Description

@MJunaidIqbaal

When a click on Intent to Receive then it always showed me the same like Intent to Received required, not showed 200 OK.

Method for ensuring_security is:

def ensuring_security?
      key = 'XERO_WEBHOOK_KEY'
      payload = request.body.read
      calculated_hmac = Base64.encode64(OpenSSL::HMAC.digest('sha256', key, payload))
      begin
        if calculated_hmac.strip() == request.headers['x-xero-signature']
          true
        else
          false
        end
      rescue JSON::ParserError => e
        false
      end
      
end

The result is alweays false because the calculated_hmac.strip() is not equal to request.headers['x-xero-signature']. I think if the intent can't be 200 OK so if I will updation in Contacts or Invoices the webhook can not be received. So What should I do?

I want to show a result of 200 OK and after this will get a webhook if updation in invoices and contacts.

Screenshot of which is receiving when click on Intent to Receive:
image

You can see in the above screenshot that two values can't be equal; first is from calculated_hmac and second from request.headers['x-xero-signature'].

And on webhook config at Xero site here:
image

So how can I get 200 OK at status and receive invoice status (regarding update any invoice), anyone please reply me ASAP. Thanks!

Metadata

Metadata

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