sendgrid-php icon indicating copy to clipboard operation
sendgrid-php copied to clipboard

docs: improve signed webhook event payload encoding

Open emnsen opened this issue 2 years ago • 0 comments

If the payload contains slashed and if you encode the data manually, then the default json_encode function escapes the slashes which causes the verification to fail.

In my case, I decoded the payload with json_decode and then encoded it before the verification. However, the payload contained the user agent data, which has slashes, and the json_encode function was escaping the slashes, causing the verification to fail. So, I encoded the data like json_encode($payload, JSON_UNESCAPED_SLASHES) with the flag, and it started to verify successfully.

emnsen avatar Feb 17 '23 11:02 emnsen