3 declare(strict_types=1);
30 private $accessTokenUrl;
35 private $tokenStorage;
39 string $accessTokenUrl,
43 $this->accessTokenUrl = $accessTokenUrl;
44 $this->client = $client;
45 $this->credentials = $credentials;
46 $this->tokenStorage = $tokenStorage;
56 $refreshToken = $this->tokenStorage->getRefreshToken();
59 self::REFRESH_TOKEN => $refreshToken,
62 'form_params' => $data,
63 'auth' => [$this->credentials->getClientId(), $this->credentials->getClientSecret()],
66 $result = $this->client->post($this->accessTokenUrl, $options);
69 $body = json_decode((
string) $result->getBody(),
true);
72 (
string) $body[self::ACCESS_TOKEN],
73 (
int) $body[self::EXPIRES_IN],