【问题标题】:Google Plus Domains API AccessTokenRefreshErrorGoogle Plus Domains API AccessTokenRefreshError
【发布时间】:2013-08-18 07:35:18
【问题描述】:

我正在尝试使用 Google+ Domains API 为我的 Google Apps 域配置圈子。我根据https://developers.google.com/+/domains/authentication/delegation 使用域范围的委派,我已经成功地将其用于组、用户和日历配置。在 API 控制台中,我已将 Google+ API 和 Google+ Domains API 添加到 API 项目中。我已经尝试使用预先存在的密钥并生成一个新密钥。当我尝试运行以下代码时:

service_account_email='somelongstring@developer.gserviceaccount.com'
key=file("path/to/keyfile","rb").read()
user_email='someroleaccount@mydomain.com'
SCOPES_PLUS = [
  'https://www.googleapis.com/auth/plus.me',
  'https://www.googleapis.com/auth/plus.stream.write',
]
credentials = SignedJwtAssertionCredentials(service_account_email, key,
                                            scope=SCOPES_PLUS, sub=user_email)
http = httplib2.Http()
http = credentials.authorize(http)
plus = build(serviceName='plus', version='v1domains', http=http)

我明白了

AccessTokenRefreshError: access_denied

当它遇到 build() 调用时。

但是,完全相同的代码(具有不同的范围和服务)适用于目录服务、组设置服务和日历服务。

我已尝试使用角色帐户作为子电子邮件地址,以及作为我自己的(超级管理员)帐户。

有什么想法吗?

【问题讨论】:

    标签: google-api google-plus google-apps google-api-python-client google-admin-sdk


    【解决方案1】:

    您是否记得在域的控制面板中为新范围的服务帐户授权?进程is described in the Drive documentation。请务必输入 Google Plus 域范围以及目录和组设置范围,因为任何更改都会覆盖您现有的授权。

    【讨论】:

      【解决方案2】:

      我已经编写了一个教程,使用 Python 在 Google App Engine 上使用新的 G+ Domains API,它逐步解释了每个必要的配置并提供了一些示例代码:

      https://gist.github.com/vircheck/6292176

      另外,不要忘记官方快速入门here,但请记住,此快速入门不适用于 App Engine。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-01-02
        相关资源
        最近更新 更多