Skip to content

Commit

Permalink
Merge pull request #3 from slovensko-digital/bugfix/auth-fix
Browse files Browse the repository at this point in the history
fix pre public endpointy
  • Loading branch information
DominikBohucak authored Jun 22, 2023
2 parents 891e145 + d459ef0 commit daaa739
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion application/src/Service/AtlassianApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
],
]);
}
Expand All @@ -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(),
]);
}
Expand Down

0 comments on commit daaa739

Please sign in to comment.