|
27 | 27 | use Google\Auth\Credentials\UserRefreshCredentials; |
28 | 28 | use Google\Auth\CredentialsLoader; |
29 | 29 | use Google\Auth\FetchAuthTokenCache; |
| 30 | +use Google\Auth\FetchAuthTokenInterface; |
30 | 31 | use Google\Auth\GetUniverseDomainInterface; |
31 | 32 | use Google\Auth\HttpHandler\HttpHandlerFactory; |
32 | 33 | use Google\Auth\OAuth2; |
@@ -94,7 +95,7 @@ class Client |
94 | 95 | private $logger; |
95 | 96 |
|
96 | 97 | /** |
97 | | - * @var ?CredentialsLoader $credentials |
| 98 | + * @var ?FetchAuthTokenInterface $credentials |
98 | 99 | */ |
99 | 100 | private $credentials; |
100 | 101 |
|
@@ -122,10 +123,10 @@ class Client |
122 | 123 | * Your Google Cloud client ID found in https://developers.google.com/console |
123 | 124 | * @type string $client_secret |
124 | 125 | * Your Google Cloud client secret found in https://developers.google.com/console |
125 | | - * @type string|array|CredentialsLoader $credentials |
| 126 | + * @type string|array|FetchAuthTokenInterface $credentials |
126 | 127 | * Can be a path to JSON credentials or an array representing those |
127 | 128 | * credentials (@see Google\Client::setAuthConfig), or an instance of |
128 | | - * {@see CredentialsLoader}. |
| 129 | + * {@see FetchAuthTokenInterface}. |
129 | 130 | * @type string|array $scopes |
130 | 131 | * {@see Google\Client::setScopes} |
131 | 132 | * @type string $quota_project |
@@ -217,7 +218,7 @@ public function __construct(array $config = []) |
217 | 218 | ], $config); |
218 | 219 |
|
219 | 220 | if (!is_null($this->config['credentials'])) { |
220 | | - if ($this->config['credentials'] instanceof CredentialsLoader) { |
| 221 | + if ($this->config['credentials'] instanceof FetchAuthTokenInterface) { |
221 | 222 | $this->credentials = $this->config['credentials']; |
222 | 223 | } else { |
223 | 224 | $this->setAuthConfig($this->config['credentials']); |
@@ -464,7 +465,8 @@ public function authorize(?ClientInterface $http = null) |
464 | 465 | $authHandler = $this->getAuthHandler(); |
465 | 466 |
|
466 | 467 | // These conditionals represent the decision tree for authentication |
467 | | - // 1. Check if a Google\Auth\CredentialsLoader instance has been supplied via the "credentials" option |
| 468 | + // 1. Check if an instance of Google\Auth\FetchAuthTokenInterface has |
| 469 | + // been supplied via the "credentials" option |
468 | 470 | // 2. Check for Application Default Credentials |
469 | 471 | // 3a. Check for an Access Token |
470 | 472 | // 3b. If access token exists but is expired, try to refresh it |
|
0 commit comments