# Exemple C# de validation de la signature de webhook

**URL:** <https://meta.discourse.org/t/c-example-of-validating-webhook-signature/97015>\
**Category:** Development\
**Created:** [Septembre 12, 2018, 6:38 UTC](https://meta.discourse.org/t/c-example-of-validating-webhook-signature/97015 "2018-09-12T06:38:07Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![PromoFaux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/promofaux/32/119589_2.png) [@PromoFaux](https://meta.discourse.org/u/PromoFaux)\
**Post date:** [Septembre 12, 2018, 10:34 UTC](https://meta.discourse.org/t/c-example-of-validating-webhook-signature/97015/2 "2018-09-12T10:34:38Z")

</div>

Hi @Julian_Elve,

So I have a method for validating the signature as follows:

> <https://github.com/PromoFaux/Matterhook.NET/blob/master/Matterhook.NET/Code/Util.cs#L13-L44>

You could probably simplify it a little to work specifically for Discourse webhooks, but I use it for both Discourse and Github hooks, so needed to be able to change out the `sha<x>=` part at the beginning.

For Discourse, it’s used like so:

> <https://github.com/PromoFaux/Matterhook.NET/blob/master/Matterhook.NET/Controllers/DiscourseHookController.cs#L79>

Hope that helps some…!

---

_[View the full topic](https://meta.discourse.org/t/c-example-of-validating-webhook-signature/97015)._
