首页 > 解决方案 > 如何在我的 Google AdWords 应用中使用其他用户的 refresh_token?

问题描述

我有一个 Google AdWords 经理帐户来管理我平台中用户的广告帐户。

如果他们想授权我,用户需要给我客户 ID(广告帐户) 。

我的问题是

是否只有经理帐户中的refresh_token可以通过 AdWords API 邀请某人?

那么,用户/管理员的refresh_token可以做什么?

node-adwords这是我使用的库。

-------- 11/12 更新--------

let user = new AdwordsUser({
  "client_id": "xxxxxxxxxxx.apps.googleusercontent.com",
  "client_secret": "xxxxxxxxxxx",
  "developerToken": "xxxxxxxxxx",
  "userAgent": "xxxx",
  "clientCustomerId": "mcc-account id",
  "debug": "true"
});

// linked customer.
user.credentials.refresh_token = 'refreshToken' (user's or mcc-account's?)

const managedCustomerService = user.getService('ManagedCustomerService', apiVersion);
const managerCustomerId = +user.credentials.clientCustomerId.split('-').join('');
const clientCustomerId = +clientId.split('-').join('');

const operation = {
  operator: 'ADD',
  operand: {
    managerCustomerId,
    clientCustomerId,
    linkStatus: 'PENDING',
    pendingDescriptiveName: 'invitation',
    isHidden: false,
  }
}

managedCustomerService.mutateLink({operations: [operation]}, (error, result)....

标签: node.jsgoogle-apigoogle-ads-api

解决方案


  1. 是的,只有经理帐户可以向其他想要管理的 adwords 用户发送邀请。

  2. 这是与此问题相关的官方google adwords 文档。您需要阅读有关身份验证的部分(靠近页面底部)。有一个图表显示了 adwords 帐户的管理层次结构。换句话说,您可以通过您的经理令牌对用户帐户进行操作(哪些帐户将受到影响取决于adwords user id您在用户凭据中指定的内容new AdwordsUser({clientCustomerId: 'xxxxxxxxxx'}))。

此外,您无需担心:

+clientId.split('-').join('');

node-adwordsxxxxxxxxxxlib或adwords api 适用于两者xxx-xxx-xxxx

我希望它可以帮助一点。


推荐阅读