python boxsdk3 webhook.validate_message returns false
- webhook.validate_message returns false when validating webhookA with python boxsdk3の
- at webhookB , valdate_message returns True even using the same configuration json( the one that includes clientSecret)
- It seems like a error in the json and webhook A coordination, but I'm stuch here
How should I investigate this issue??
-
Sorry for the late response.
The code and id is below!!
is_valid in download_image_from_box() becomes False.
box_secret.json used in get_box_client() is configuration json.image, box_file_id = download_image_from_box({"body": request.body, "headers": request.headers})
def download_image_from_box(event: dict) -> None:
client, webhook_key, folderName = get_box_client()
raw_body = event["body"]
body = json.loads(raw_body)
webhook_id = body["webhook"]["id"]
webhook = client.webhook(webhook_id)
is_valid = webhook.validate_message(raw_body, event["headers"], webhook_key)
def get_box_client():
json_open = open('box_secret.json', 'r')
secret = json.load(json_open)
client_id = secret["boxAppSettings"]["clientID"]
client_secret = secret["boxAppSettings"]["clientSecret"]
jwt_key_id = secret["boxAppSettings"]["appAuth"]["publicKeyID"]
rsa_private_key_data = secret["boxAppSettings"]["appAuth"]["privateKey"]
rsa_private_key_passphrase = secret["boxAppSettings"]["appAuth"]["passphrase"]
enterprise_id = secret["enterpriseID"]
folderName = secret["folderName"]
webhook_signature_key = secret["webhookPrimaryKey"]
auth = JWTAuth(
client_id=client_id,
client_secret=client_secret,
jwt_key_id=jwt_key_id,
rsa_private_key_data=rsa_private_key_data,
rsa_private_key_passphrase=rsa_private_key_passphrase,
enterprise_id=enterprise_id
)
auth.authenticate_instance()
client = Client(auth)
return client, webhook_signature_key, folderName$ box webhooks
----- Webhook 574783230 -----
ID: '574783230'
Type: webhook
Target:
ID: '128629204110'
Type: folder
Post is closed for comments.
Comments
2 comments