首页 文章

Google Plus Domains API AccessTokenRefreshError

提问于
浏览
1

我'm attempting to use the Google+ Domains API to provision circles for my Google Apps domain. I'm使用域名范围的委托https://developers.google.com/+/domains/authentication/delegation我已成功用于组,用户和日历配置 . 在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()调用 .

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

我已尝试将角色帐户作为子电子邮件地址,并作为我自己的(超级管理员)帐户 .

有任何想法吗?

2 回答

  • 1

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

  • 2

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

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

    另外,不要忘记官方快速启动here但请记住,这个在App Engine上不起作用 .

相关问题