Comments (6)
See this comment for how to set the subject (e.g. enable domain-wide delegation)
from google-cloud-php.
after setting up domain wide delegation and other related configurations on google cloud console this code worked for me
public function index(){
$credentials = (new ServiceAccountCredentials(['https://www.googleapis.com/auth/meetings.space.readonly','https://www.googleapis.com/auth/meetings.space.created']
,base_path("key.json"),
'[email protected]'
));
// Create a client.
$spacesServiceClient = new SpacesServiceClient(['credentials' => $credentials]);
// Prepare the request message.
$request = new CreateSpaceRequest();
// Call the API and handle any network failures.
try {
/** @var Space $response */
$response = $spacesServiceClient->createSpace($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
from google-cloud-php.
Whats the "Other related configurations on google cloud console" configurations you did @erensertkaya ?
from google-cloud-php.
Anyone can help, i tried adding domain wide delegation with specified oauth scopes which stated in documentation but i am still getting same error ?
from google-cloud-php.
from google-cloud-php.
For adding using domain wide delegation i updated my code to this which is for impersonate my main user from service account but it's not working since SpacesServiceClient not accepting Client object but $options i started to think that this package not allowing you impersonate yet.
public function index(){
putenv('GOOGLE_APPLICATION_CREDENTIALS=' . base_path("key.json"));
$client = new Client();
$client->useApplicationDefaultCredentials();
$client->addScope('https://www.googleapis.com/auth/meetings.space.readonly');
$client->addScope('https://www.googleapis.com/auth/meetings.space.created');
$client->setSubject('[email protected]');
$options = [
'credentials' => $client,
];
// Create a client.
$spacesServiceClient = new SpacesServiceClient($options);
// Prepare the request message.
$request = new CreateSpaceRequest();
// Call the API and handle any network failures.
try {
/** @var Space $response */
$response = $spacesServiceClient->createSpace($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
from google-cloud-php.
Related Issues (20)
- "serviceusage.services.use" Permission denied. HOT 9
- PHP Reference Docs not generating for new releases HOT 4
- Can't make analytics calls work through a proxy server HOT 3
- FR: Support for Storage HNS enablement HOT 1
- Database::executePartitionedUpdate() returns string instead of int
- Feature Request: move all .repo-metadata.json into one .repo-metadata-full.json
- batchAnnotateFiles failing silently (and taking php thread with it) HOT 2
- Speech API: Cannot use explicit_decoding_config with encoding = ENCODING_UNSPECIFIED HOT 1
- Remove unnecessary abstraction of bytes type or give an option to skip that abstraction HOT 2
- Doesn't return all rows, only the first "package" HOT 6
- Uploading a stream resource's contents to a bucket results in the resource being closed HOT 2
- API key HOT 1
- Storage: Add HNS folders samples
- feat(dev): add filter and sort to component-info command HOT 1
- storage: Samples for Managed Folders
- docs: investigate failing references
- Dev unittests are failing HOT 1
- add rowFilter => filter to bigtable MIGRATING.md for v2 HOT 1
- Add bigtable-attempt to request metadata when the RPC is a retry attempt HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-cloud-php.