From 55c4276d9bfb3a17d23a6fae119de757e659ec80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maurice=20Preu=C3=9F?= Date: Sun, 2 Jan 2022 18:52:35 +0100 Subject: [PATCH] Update BitinflowAccountsSsoUserProvider.php --- .../Providers/BitinflowAccountsSsoUserProvider.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/GhostZero/BitinflowAccounts/Providers/BitinflowAccountsSsoUserProvider.php b/src/GhostZero/BitinflowAccounts/Providers/BitinflowAccountsSsoUserProvider.php index 336a2b9..569db66 100644 --- a/src/GhostZero/BitinflowAccounts/Providers/BitinflowAccountsSsoUserProvider.php +++ b/src/GhostZero/BitinflowAccounts/Providers/BitinflowAccountsSsoUserProvider.php @@ -41,17 +41,25 @@ class BitinflowAccountsSsoUserProvider implements UserProvider public function retrieveById($identifier) { $model = $this->createModel(); + $token = $this->request->bearerToken(); $user = $this->newModelQuery($model) ->where($model->getAuthIdentifierName(), $identifier) ->first(); + // Update access token when updated + if ($this->accessTokenField) { + $user[$this->accessTokenField] = $token; + + if ($user->isDirty()) { + $user->save(); + } + } + if ($user) { return $user; } - $token = $this->request->bearerToken(); - $this->bitinflowAccounts->setToken($token); $result = $this->bitinflowAccounts->getAuthedUser();