|
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; |
@@ -90,7 +91,7 @@ class Client |
90 | 91 | private $logger; |
91 | 92 |
|
92 | 93 | /** |
93 | | - * @var ?CredentialsLoader $credentials |
| 94 | + * @var ?FetchAuthTokenInterface $credentials |
94 | 95 | */ |
95 | 96 | private $credentials; |
96 | 97 |
|
@@ -118,10 +119,10 @@ class Client |
118 | 119 | * Your Google Cloud client ID found in https://developers.google.com/console |
119 | 120 | * @type string $client_secret |
120 | 121 | * Your Google Cloud client secret found in https://developers.google.com/console |
121 | | - * @type string|array|CredentialsLoader $credentials |
| 122 | + * @type string|array|FetchAuthTokenInterface $credentials |
122 | 123 | * Can be a path to JSON credentials or an array representing those |
123 | 124 | * credentials (@see Google\Client::setAuthConfig), or an instance of |
124 | | - * {@see CredentialsLoader}. |
| 125 | + * {@see FetchAuthTokenInterface}. |
125 | 126 | * @type string|array $scopes |
126 | 127 | * {@see Google\Client::setScopes} |
127 | 128 | * @type string $quota_project |
@@ -213,7 +214,7 @@ public function __construct(array $config = []) |
213 | 214 | ], $config); |
214 | 215 |
|
215 | 216 | if (!is_null($this->config['credentials'])) { |
216 | | - if ($this->config['credentials'] instanceof CredentialsLoader) { |
| 217 | + if ($this->config['credentials'] instanceof FetchAuthTokenInterface) { |
217 | 218 | $this->credentials = $this->config['credentials']; |
218 | 219 | } else { |
219 | 220 | $this->setAuthConfig($this->config['credentials']); |
@@ -460,7 +461,8 @@ public function authorize(?ClientInterface $http = null) |
460 | 461 | $authHandler = $this->getAuthHandler(); |
461 | 462 |
|
462 | 463 | // These conditionals represent the decision tree for authentication |
463 | | - // 1. Check if a Google\Auth\CredentialsLoader instance has been supplied via the "credentials" option |
| 464 | + // 1. Check if an instance of Google\Auth\FetchAuthTokenInterface has |
| 465 | + // been supplied via the "credentials" option |
464 | 466 | // 2. Check for Application Default Credentials |
465 | 467 | // 3a. Check for an Access Token |
466 | 468 | // 3b. If access token exists but is expired, try to refresh it |
|
0 commit comments