I convert that code into C# code and I have the same problem.
if (!(payload.Event.IsNullOrDefault()) && payload.Event == “endpoint.url_validation”)
{
var hashForValidate = new System.Security.Cryptography.HMACSHA256(Encoding.UTF8.GetBytes(secretToken)).ComputeHash(Encoding.UTF8.GetBytes(payload.payload.plainToken));
//hmac.ComputeHash(Encoding.UTF8.GetBytes(payload.payload.plainToken));
var hashed = ToHex(hashForValidate, false);
var validationResponse = new
{
message = new
{
plainToken = payload.payload.plainToken,
encryptedToken = hashed
},
status = 200
};
log.LogInformation($"Validation Response: {JsonConvert.SerializeObject(validationResponse)}");
return new OkObjectResult(validationResponse);
}
hello @vladimir.rivera
i did the same api like
public async Task ZoomEndSessionWebhook()
{
string requestBody = await new StreamReader(_baseService.HttpContextAccessor.HttpContext.Request.Body).ReadToEndAsync();
var timeSpane = _baseService.HttpContextAccessor.HttpContext.Request.Headers[“x-zm-request-timestamp”].ToString();
var EndZoomSessionWebhookDto = JsonConvert.DeserializeObject(requestBody);
var encoding = new System.Text.ASCIIEncoding();
var sha256 = new System.Security.Cryptography.HMACSHA256();
string message = $“v0:{timeSpane}:{requestBody}”;
sha256.Key = encoding.GetBytes(_zoomSetting.ZoomWebhookSecretKey);
var hash = sha256.ComputeHash(encoding.GetBytes(message));
var hashed = ToHex(hash, false);
string signature = $"v0={hashed}";
if (signature == _baseService.HttpContextAccessor.HttpContext.Request.Headers["x-zm-signature"]) {
if (EndZoomSessionWebhookDto.@event == "endpoint.url_validation") {
var plain = new System.Security.Cryptography.HMACSHA256();
plain.Key = encoding.GetBytes(_zoomSetting.ZoomWebhookSecretKey);
var hashForValidate = plain.ComputeHash(encoding.GetBytes(EndZoomSessionWebhookDto.payload.plainToken));
var hashString = ToHex(hashForValidate, false);
return Ok(new { plainToken = result.message.plainToken, encryptedToken = result.message.encryptedToken });
but still getting invalid url