From 24a8653fab61ddac37ec81a653e8ea6609c3b47b Mon Sep 17 00:00:00 2001 From: daniele strollo Date: Thu, 1 Jul 2021 12:08:14 +0200 Subject: [PATCH] Update webhook_backend.py At the request via webhook just uses default pre configured headers (with Agent/ContentType) by ignoring at all customer provided headers (self.headers). Thus the OAuth authentication via Bearer cannot be implemented since custom headers are not sent to service so receiving Unauthorized response. Solution is merging the default headers with custom ones (custom headers will override default ones in case of key clash). --- awx/main/notifications/webhook_backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/main/notifications/webhook_backend.py b/awx/main/notifications/webhook_backend.py index 3e38ae3cab..342184ecf2 100644 --- a/awx/main/notifications/webhook_backend.py +++ b/awx/main/notifications/webhook_backend.py @@ -72,7 +72,7 @@ class WebhookBackend(AWXBaseEmailBackend, CustomNotificationBase): "{}".format(m.recipients()[0]), auth=auth, data=json.dumps(m.body, ensure_ascii=False).encode('utf-8'), - headers=get_awx_http_client_headers(), + headers=dict(list(get_awx_http_client_headers().items()) + list((self.headers or {}).items())), verify=(not self.disable_ssl_verification), ) if r.status_code >= 400: