From a740333f97c1994fa20896d405437146327a9ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=BB=D1=8C=D1=8F?= <38153753+ilyakharev@users.noreply.github.com> Date: Tue, 6 Jun 2023 17:33:44 +0300 Subject: [PATCH 1/2] Update Iam.php --- src/Iam.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Iam.php b/src/Iam.php index 90e9c227..6bbfc863 100644 --- a/src/Iam.php +++ b/src/Iam.php @@ -403,11 +403,14 @@ protected function saveToken($token) $this->expires_at = $this->convertExpiresAt($token->expiresAt ?? ''); $this->refresh_at = $token->refreshAt; - file_put_contents($tokenFile, json_encode([ + $randPath = $tokenFile."-tmp".bin2hex(random_bytes(10)); + file_put_contents($randPath, json_encode([ 'iamToken' => $this->iam_token, 'expiresAt' => $this->expires_at, 'refreshAt' => $this->refresh_at ])); + rename($randPath, $tokenFile); + } /** From b48610fd8becb4df704a4b2d7de41a40e894901f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=BB=D1=8C=D1=8F?= <38153753+ilyakharev@users.noreply.github.com> Date: Tue, 6 Jun 2023 17:42:49 +0300 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6b95591..39bf23e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +* updated saveToken function in Iam.php + ## 1.5.4 * fixed jwt authentication