0
votes

I'm trying to get an authenticated user's Google Cloud project role through the PHP Google Cloud API.

I have looked through the Google Cloud Accounts API, the Google IAM API, and the oAuth API, but haven't found an endpoint that responds with the required information.

I would like to receive a response via the following: I have authenticated to Google via oAuth. I submit a project id (ie. my-test-project) to the endpoint and if I have access to a project by that name, it tells me what my role is in that project (owner, editor, viewer, or other IAM role).

1

1 Answers

0
votes

This isn't an exact solution, but it does provide the projects that the user has access to:

$client = new Google_Client();
...
do client oAuth authorization steps
...
// create a BigQuery Services and see what projects it has access to
$gbq_service = new Google_Service_Bigquery($client);
$project_list = $gbq_service->projects->listProjects();
$projects = $project_list->getProjects();