From eafff15a4dfb912107f3b4507f02656a68d44b9a Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Wed, 13 Dec 2023 19:17:51 +0530 Subject: [PATCH] Added default value for access token --- src/VCS/Adapter/Git/GitHub.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/VCS/Adapter/Git/GitHub.php b/src/VCS/Adapter/Git/GitHub.php index cf795255..f5f3bd67 100644 --- a/src/VCS/Adapter/Git/GitHub.php +++ b/src/VCS/Adapter/Git/GitHub.php @@ -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'] ?? ''; } } @@ -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'] ?? ''; } /**