I am trying to list all projects I have in GCP by using the projects.list
method from the Resource Manager API but I cannot figure out what access token to be used.
Let's say I have three projects:
My Project 44572
Testing
My First Project
And when I use the projects.list
method it should give me the output as this:
{
"projects": [
{
"name": "My Project 44572",
"parent": {
"type": "organization",
"id": "ORG_ID"
},
"projectId": "PROJECT_ID",
"projectNumber": "PROJECT_NUMBER",
"lifecycleState": "ACTIVE",
"createTime": "2020-06-15T08:38:04.712Z"
},
{
"name": "Testing ",
"parent": {
"type": "organization",
"id": "ORG_ID"
},
"projectId": "PROJECT_ID",
"projectNumber": "PROJECT_NUMBER",
"lifecycleState": "ACTIVE",
"createTime": "2020-06-15T08:35:59.480Z"
},
{
"name": "My First Project",
"parent": {
"type": "organization",
"id": "ORG_ID"
},
"projectId": "PROJECT_ID",
"projectNumber": "PROJECT_NUMBER",
"lifecycleState": "ACTIVE",
"createTime": "2020-06-15T08:33:23.859Z"
}
]
}
But if I am using the Access Token which I got by using service account of My Project 44572
I am getting the following output:
{
"projects": [
{
"name": "My Project 44572",
"parent": {
"type": "organization",
"id": "ORG_ID"
},
"projectId": "PROJECT_ID",
"projectNumber": "PROJECT_NUMBER",
"lifecycleState": "ACTIVE",
"createTime": "2020-06-15T08:38:04.712Z"
}
]
}
So, what access token I should use so that I would get all projects under my organization?