node.js - 如何在我的 Google AdWords 应用中使用其他用户的 refresh_token?
问题描述
我有一个 Google AdWords 经理帐户来管理我平台中用户的广告帐户。
如果他们想授权我,用户需要给我客户 ID(广告帐户) 。
当我使用从连接我的谷歌帐户获得的refresh_token时,我可以邀请任何客户 ID进行链接。
但是,如果用户使用通过连接他们的 Google 帐户获得的refresh_token,它将获得
USER_PERMISSION_DENIED
.
我的问题是
是否只有经理帐户中的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)....
解决方案
是的,只有经理帐户可以向其他想要管理的 adwords 用户发送邀请。
这是与此问题相关的官方google adwords 文档。您需要阅读有关身份验证的部分(靠近页面底部)。有一个图表显示了 adwords 帐户的管理层次结构。换句话说,您可以通过您的经理令牌对用户帐户进行操作(哪些帐户将受到影响取决于
adwords user id
您在用户凭据中指定的内容new AdwordsUser({clientCustomerId: 'xxxxxxxxxx'})
)。
此外,您无需担心:
+clientId.split('-').join('');
node-adwords
xxxxxxxxxx
lib或adwords api 适用于两者xxx-xxx-xxxx
我希望它可以帮助一点。
推荐阅读
- c++ - C ++,使用初始化程序但用于函数?
- javascript - 角度材质对话框发射器
- autodesk-forge - 获取属性端点中缺少某些属性
- oracle - PL/SQL 的执行流程
- iot - 我们在哪里可以看到 zigbee call fow 中传感器的心跳?
- ruby-on-rails - 电子邮件中的 Sendgrid 链接产生您的连接不是浏览器中的私人错误
- sql - 选择案例中的错误
- javascript - 角度表 - 调整性能不佳的大型表
- batch-file - 如何在批处理脚本的 FOR 循环中寻址元素 i+1?
- ignite - Apache Ignite 数据区域行为