From d459ef098c802f8044b15752541b94c0731dbade Mon Sep 17 00:00:00 2001 From: Dominik Bohuncak Date: Thu, 22 Jun 2023 16:30:06 +0200 Subject: [PATCH] fix pre public endpointy --- application/src/Service/AtlassianApiService.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/src/Service/AtlassianApiService.php b/application/src/Service/AtlassianApiService.php index 4359bd3..0b00daa 100644 --- a/application/src/Service/AtlassianApiService.php +++ b/application/src/Service/AtlassianApiService.php @@ -13,16 +13,17 @@ class AtlassianApiService { private Client $client; + private ?string $token; public function __construct() { + $this->token = getenv('jira_auth_token'); $this->client = new Client([ 'base_uri' => getenv('jira_api_host'), 'headers' => [ 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'Access-Control-Allow-Origin' => '*', - 'Authorization' => 'Basic '.getenv('jira_auth_token'), ], ]); } @@ -33,6 +34,9 @@ public function __construct() public function sendIssue(AttlassianIssueModel $data): ResponseInterface { return $this->client->post('servicedeskapi/request', [ + RequestOptions::HEADERS => [ + 'Authorization' => 'Basic '.$this->token, + ], RequestOptions::JSON => $data->toArray(), ]); }