I want to validate if the webhook was indeed from Appwrite and it works if the payload does not include special UTF-8 characters like ä,ü,ö etc. But when the payload includes these characters the hash/signature is diffrent...
I use C# for validateing the hash... here is the code:
TypeScript
string payload;
using var reader = new StreamReader(context.Request.InputStream, Encoding.UTF8);
payload = await reader.ReadToEndAsync();
string signature = _webHookUrl + payload.Trim();
string hash = Convert.ToBase64String(hMACSHA1.ComputeHash(Encoding.UTF8.GetBytes(signature)));
if (!context.Request?.Headers?.Get("x-appwrite-webhook-signature")?.Equals(hash) ?? true)
{
// Error hash is invalid
return;
}
TL;DR
Webhook verification fails when payloads have UTF-8 characters. The hash/signature is different when special characters like ä,ü,ö are present. The issue stems from Unicode encoding. Ensure consistent encoding when calculating hash.Recommended threads
- Invalid token passed in the request
Hello, I have an issue using updateMagicURLSession. I send the email using sendMagicLink, which works fine. When i click the link in the email i get the invali...
- functions domain error
I cannot set up the domain for function I’m trying to add the domain api.example.com I can only use Cloudflare as the DNS provider because my domain provider do...
- Storage Bucket Permissions
Hey folks, when enabling CRUD on the bucket level for the role any, should the bucket be accessible when using a session client?