0
votes

I have a couple Cloud Storage buckets I want to access programatically via API, but the buckets are visible solely to members of a google group. (They're for Doubleclick bid manager reports, if that helps) I provided the name and group email address for a group that I made specifically to get access to these cloud storage buckets.

Looking around on my individual developer console, I can gain access to authentication stuff so I can access my own google account's buckets, but when I use the credentials from my google developer console's project, hopefully granting me access based on which account I'm using (Which I'm assuming is totally wrong) using this code:

    $key = file_get_contents("[PATH_TO_KEY].p12");
    $cred = new Google_Auth_AssertionCredentials("[ACCOUNT STUFF]", 
                                                array("https://www.googleapis.com/auth/devstorage.full_control"), 
                                                $key);
    $client->setAssertionCredentials($cred);
    $client->setClientId($client_id);
    $client->setClientSecret($client_secret);
    $client->setDeveloperKey($dev_api_key);
    $client->setRedirectUri($redirect);
    $client->setScopes("https://www.googleapis.com/auth/devstorage.full_control");
    $service = new Google_Service_Storage($client);
    $bucket = $service->objects->listObjects($da_bucket);

I get a 403. (I might also be authenticating wrong. sorry trying to POC something here)

Is there some place where I can gain API access for a bucket that's accessible for all members of a Google group, but not specifically me?

1

1 Answers

2
votes

The service account associated with that .p12 key needs to be a member of the group that can read the bucket.