Skip to content

Commit 4752137

Browse files
authored
Merge pull request #40 from bumperbox/patch-1
Throw exception if unable to write token to file
2 parents 6edd1c7 + e4b8460 commit 4752137

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Oauth2CredentialManagers/FileStore.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,17 @@ public function refresh(): void
9191

9292
public function store(AccessTokenInterface $token, string $tenantId = null): void
9393
{
94-
$this->files->put($this->filePath, json_encode([
94+
$ret = $this->files->put($this->filePath, json_encode([
9595
'token' => $token->getToken(),
9696
'refresh_token' => $token->getRefreshToken(),
9797
'id_token' => $token->getValues()['id_token'],
9898
'expires' => $token->getExpires(),
9999
'tenant_id' => $tenantId ?? $this->getTenantId()
100100
]));
101+
102+
if ($ret === false) {
103+
throw new \Exception("Failed to write to file: {$this->filePath}");
104+
}
101105
}
102106

103107
public function getUser(): ?array

0 commit comments

Comments
 (0)