You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The https://github.com/googleapis/google-api-php-client library allows to authenticate using Service Accounts keys in JSON format and also impersonificate another user within a domain (which requires domain-wide delegation to be enabled). This is simply done as:
$client = new Google_Client();
$client->setSubject('address_to_act_as@example.com');
Could we please have this functionality as well in this library? From what I've seen there is a class \Google\Auth\Credentials\ServiceAccountCredentials with a constructor's 3rd argument for setting impersonation subject but this is never used/referenced. What's more - hardcoding a valid address to impersonate also fails with the permission denied for provided property id - error code 7.
The text was updated successfully, but these errors were encountered:
If you look at the code in Google\Client.php, it uses the same class you're referring to, ServiceAccountCredentials, to set the subject. So using that class and supplying the subject to its constructor would hav the same efect:
$credentials = newGoogle\Auth\Credentials\ServiceAccountCredentials($scope, $credFile, $subject);
// the configuration option may be different depending on the client$bigquery = newGoogle\Cloud\BigQuery\BigQueryClient(['credentialsFetcher' => $credentials]);
$analytics = newGoogle\Cloud\AnalyticsData\V1\BetaAnalyticsDataClient(['credentials' => $credentials]);
Be sure to check the constructor options for your clients to see which parameter (credentials or credentialsFetcher) it accepts
The
https://github.com/googleapis/google-api-php-client
library allows to authenticate using Service Accounts keys in JSON format and also impersonificate another user within a domain (which requires domain-wide delegation to be enabled). This is simply done as:Could we please have this functionality as well in this library? From what I've seen there is a class
\Google\Auth\Credentials\ServiceAccountCredentials
with a constructor's 3rd argument for setting impersonation subject but this is never used/referenced. What's more - hardcoding a valid address to impersonate also fails with the permission denied for provided property id - error code 7.The text was updated successfully, but these errors were encountered: