用户无法访问帐户

时间:2019-12-10 13:46:58

标签: javascript node.js google-apis-explorer google-shopping-api

我在创建数据供稿作为新的子帐户时遇到问题。我有这样的东西。 我尝试创建subAccount,然后为该帐户添加供稿。

    async createAccount(client, data) {
        const endpoint = google.content({ version: 'v2', auth: client });
        return endpoint.accounts.insert(data);
    }

    async createFeed(client, data) {
        const endpoint = google.content({ version: 'v2', auth: client });
        return endpoint.datafeeds.insert(data)
    }

    async createFeedInGoogle() {
        const auth = new google.auth.GoogleAuth({
            // Scopes can be specified either as an array or as a single, space-delimited string.
            scopes: [
                'https://www.googleapis.com/auth/compute',
                'https://www.googleapis.com/auth/content',
            ]
        });

        const authClient = await auth.getClient();
        const client = await authClient.authorize();

        const url = 'https://test.pl';

        const res = await this.createAccount(client, {
            auth: authClient,
            merchantId: 11111,
            dry: true,
            requestBody: {
                name: 'testowyTest.pl',
                websiteUrl: url,
            }
        });

        try {
            const res2 = await this.createFeed(client, {
                auth: authClient,
                merchantId: res.data.id,
                dryRun: true,
                requestBody: {
                    contentType: 'product inventory',
                    fileName: url,
                    name: url,
                }
            });
        } catch (err) {
            console.log(err);
        }
    }

当我运行createFeed方法时,此返回错误类似

    Error: User cannot access account <res.data.id>

您有什么想法,我该如何解决?

0 个答案:

没有答案