Skip to content

Commit

Permalink
Merge pull request #13 from utopia-php/fix-default-value-for-access-t…
Browse files Browse the repository at this point in the history
…oken

Added default value for access token
  • Loading branch information
christyjacob4 authored Dec 14, 2023
2 parents f135291 + eafff15 commit 86c3f42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/VCS/Adapter/Git/GitHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public function initializeVariables(string $installationId, string $privateKey,
$this->cache->save($installationId, $tokens);
} else {
$parsed = \json_decode($response, true);
$this->jwtToken = $parsed['jwtToken'];
$this->accessToken = $parsed['accessToken'];
$this->jwtToken = $parsed['jwtToken'] ?? '';
$this->accessToken = $parsed['accessToken'] ?? '';
}
}

Expand Down Expand Up @@ -303,7 +303,7 @@ protected function generateAccessToken(string $privateKey, string $githubAppId):
$token = $jwt->encode($payload);
$this->jwtToken = $token;
$res = $this->call(self::METHOD_POST, '/app/installations/' . $this->installationId . '/access_tokens', ['Authorization' => 'Bearer ' . $token]);
$this->accessToken = $res['body']['token'];
$this->accessToken = $res['body']['token'] ?? '';
}

/**
Expand Down

0 comments on commit 86c3f42

Please sign in to comment.