add support of refresh token

This commit is contained in:
Beu
2024-07-31 11:36:15 +02:00
parent eb1ddce377
commit 17d1e1db1e
3 changed files with 42 additions and 1 deletions

View File

@@ -42,6 +42,11 @@ class TrackManiaAuthenticator extends OAuth2Authenticator
$client = $this->clientRegistry->getClient('TrackMania');
$accessToken = $this->fetchAccessToken($client);
// Store the refresh token in the session
if ($accessToken->getRefreshToken() !== null) {
$request->getSession()->set('oauth2_trackmania_accesstoken', $accessToken);
}
$selfvalidating = new SelfValidatingPassport(
new UserBadge($accessToken->getToken(), function() use ($accessToken, $client) {
/** @var Beu\TrackMania\OAuth2\Client\Provider\TrackManiaProviderOwner $user */