1
votes

I'm trying to write a simple web app that the user authenticates with Google Cloud using the OAuth flow.

This is fine; scopes work, and I'm all logged in, however I need to present the user with a list of their "projects" in google compute, and allow them to select the project they wish to continue with.

"gcloud projects list" is the kind of output I want, however I can't figure out the API equivalent to get this list back?

Thanks Karl

1
If you know which gcloud command makes an api call you are interested, you can use '--log-http' flag which will display all api calls and responses made by the command. - cherba
Thanks, that's a useful little tip! - Stono

1 Answers

0
votes

OK for those who struggle with this too I found the answer. You need to enable "Cloud Resource Manager API" on your project, and then use google.cloudresourcemanager('v1').projects.list

https://cloud.google.com/resource-manager/reference/rest/v1/projects/list