googleapis / googleapis/google-api-nodejs-client

can not retrieve tagmanger accounts list

Open
#3,046 0 comments 0 reactions 0 assignees View on GitHub
priority: p3 type: question
Dominant language
TypeScript
Stars
12.2k
Forks
2k
Avg merge
1d 9h
Merged PRs (30d)
24

Description

what I am trying to do is listing the accounts on my tagmanager account but I received empty data from the request, although I have 2 accounts on my tagmanger hear is my code

`import { google } from "googleapis";

const SCOPES = [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/tagmanager.manage.accounts",
"https://www.googleapis.com/auth/tagmanager.edit.containers",
"https://www.googleapis.com/auth/tagmanager.readonly",
"https://www.googleapis.com/auth/tagmanager.delete.containers",
"https://www.googleapis.com/auth/tagmanager.edit.containerversions",
"https://www.googleapis.com/auth/tagmanager.manage.users",
"https://www.googleapis.com/auth/tagmanager.publish",
];

const main = async () => {
try {
const tagManager = await initTagManagerObject();

const accounts = await tagManager.accounts.list({});

console.log("accounts", accounts.data); // prints {}
} catch (error) {
console.log("error", error);
}
};

const initTagManagerObject = async () => {
const serviceAuth = new google.auth.GoogleAuth({
keyFile: "./tag-manager-360107-9b3448dfc173.json",
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: SCOPES.join(" "),
});

const tagManager = await google.tagmanager({
version: "v2",
auth: serviceAuth,
});

return tagManager;
};

main();
`
output is: accounts {}
I am use "googleapis": "^107.0.0",

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.