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(), ]); }