Merge pull request #8 from envoyr/master

Update BitinflowAccountsSsoUserProvider.php
This commit is contained in:
René Preuß
2022-01-02 19:01:07 +01:00
committed by GitHub

View File

@@ -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();