List all projects without OAuth2
Is it possible to use the resource manager to list all projects with a service account? How con I use the resource manager api with this package?
@francesco-clementi-bip :wave: it should be possible to use a service account:
- create and download the service account credentials, as a JSON file.
- set the variable
GOOGLE_APPLICATION_CREDENTIALS, which should be the absolute path to the JSON file created in step 1.
There is documentation on this topic here.
Let me know if this does the trick for you.
Hi, thanks for your response. I managed to use a service account with permissions of owner and browser, but the resource manager api return only one project (the one of the service account), but I need all the projects. Any idea?
Here the code that I'm trying and that return only the project with service account, even if I set the role of browser.
const {Resource} = require('@google-cloud/resource');
const keyFilename = 'path_to_json_service_account';
const resource = new Resource({keyFilename});
const [projects] = await resource.getProjects();
console.log("PROJECTS",projects)