coinbase / coinbase-commerce-php

Coinbase Commerce PHP
MIT License
137 stars 155 forks source link

No webhook signature #29

Closed zNoobs closed 4 years ago

zNoobs commented 4 years ago

Hi, The Coinbase Commerce webhook request DOES NOT include the "X-CC-Webhook-Signature" header. I'm receiving the request on a php page; here all the headers I get:

{
    "User-Agent": "weipay-webhooks",
    "Content-Length": "1453",
    "X-Forwarded-For": "54.175.255.217",
    "X-Predictor": "1",
    "Host": "my.domain.name.com"
}

I've obviously whitelisted my domain. I think Coinbase is doing a fowarding and forgot to foward the headers in the request... Someone knows how to fix this? I contacted Coinbase Support recently, waiting for their reply.

zNoobs commented 4 years ago

I was using the example: https://github.com/coinbase/coinbase-commerce-php/blob/master/examples/Webhook/Webhook.php

But the php method getallheaders() returns only the 5 keys I posted in my previous message.

I found a solution to get the webhook signature, I'm using $_SERVER variable, the webhook signature is in: $_SERVER['HTTP_X_CC_WEBHOOK_SIGNATURE']

I added the fix in the example, check my commit: https://github.com/coinbase/coinbase-commerce-php/compare/master...zNoobs:patch-1

I'm closing the issue.