3 Commits

Author SHA1 Message Date
René Preuß
8232de4003 Update OauthTrait.php 2025-07-30 23:08:13 +02:00
René Preuß
ac3e28f67f Update composer.json 2025-07-30 21:52:09 +02:00
63e3f0a4a2 add refresh token method
Signed-off-by: Maurice Preuß (envoyr) <hello@envoyr.com>
2025-05-02 07:29:43 +02:00
3 changed files with 20 additions and 8 deletions

View File

@@ -15,8 +15,8 @@
"require": {
"php": "^8.1",
"ext-json": "*",
"illuminate/support": "^11.0|^12.0",
"illuminate/console": "^11.0|^12.0",
"illuminate/support": "^10.0|^11.0|^12.0",
"illuminate/console": "^10.0|^11.0|^12.0",
"guzzlehttp/guzzle": "^6.3|^7.0",
"socialiteproviders/manager": "^3.4|^4.0.1",
"firebase/php-jwt": "^6.0"
@@ -49,4 +49,4 @@
}
}
}
}
}

View File

@@ -46,6 +46,20 @@ trait ManagesUsers
return $this->post('v1/users', $attributes);
}
/**
* Refreshes the access token using the refresh token.
*/
public function refreshToken(string $storedRefreshToken, string $scope = ''): Result
{
return $this->post('../oauth/token', [
'grant_type' => 'refresh_token',
'refresh_token' => $storedRefreshToken,
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'scope' => $scope,
]);
}
/**
* Checks if the given email exists.
*

View File

@@ -23,13 +23,11 @@ trait OauthTrait
],
]);
$result = new Result($response, null);
$result = new Result($response, null, $this);
} catch (RequestException $exception) {
$result = new Result($exception->getResponse(), $exception);
$result = new Result($exception->getResponse(), $exception, $this);
}
$result->anikeenId = $this;
return $result;
}
}
}