Implementing client secret validation

"""
print("timestamp", timestamp)
print("body", body)
message = f"v0:{timestamp}:{json.dumps(body)}"
print("!!!message", message)
return hmac.new(bytes(ZOOM_WEBHOOK_SECRET_TOKEN, 'utf-8'), bytes(message, 'utf-8'), hashlib.sha256).hexdigest()

def validate_webhook_challenge(request):
“”"
Handle a Zoom webhook challenge request.
“”"
print(“request”, request)
if request[‘httpMethod’] == “POST”:
request_data = json.loads(request[‘body’])
if “event” in request_data and request_data[“event”] == “endpoint.url_validation”:
print(“request_data”, request_data)
plain_token = request_data[“payload”][“plainToken”]
hashed_token = generate_signature(request[‘headers’][“x-zm-request-timestamp”], request_data)
response_data = {
“plainToken”: plain_token,
“encryptedToken”: hashed_token
}
print(“response_data”, response_data)
return json.dumps(response_data) #, 200, {“Content-Type”: “application/json”}
return “”, 200

— response is:
“{"plainToken": "y7v_f12AQa6pS0BG6TlnqQ", "encryptedToken": "f7e37e9aba1d4033c92134ae71d7d22b9ebfae69109c9dc056847c462a0b9623"}”

I also tried without json.dumps in the end.

Hi @tomeriko
Thanks for reaching out to the Zoom Developer Forum.
Have you been able to troubleshoot this error or do you still need assistance?

Hi
I still need assistance. What is the exact format Zoom expects?
Do you have some sample code in python?

Hi @tomeriko
Unfortunately, we do not have a sample app in python.

Here is the sample app that is available

Hope this helps,
Elisa

This topic was automatically closed 368 days after the last reply. New replies are no longer allowed.