【发布时间】:2014-05-30 09:40:18
【问题描述】:
我通过 Google Play 开发者控制台创建了游戏(它是 ready for testing,但尚未发布)。
这里添加了两个服务帐户作为测试人员 - myappid@appspot.gserviceaccount.com(Google App Engine 服务帐户)和 64436212345-enq9gkd1abcdefghjec2kha39je5ojsc@developer.gserviceaccount.com(手动创建的服务帐户,它是在授予对 Google Play 游戏服务 API 的访问权限之前创建的)。第一个用于生产 GAE 环境,第二个用于开发环境(使用--appidentity_email_address 运行)。这两个帐户都可以很好地与 Google Analytics API 配合使用。
现在我尝试使用这些帐户来使用 Google Play Game Services API。
以下代码用于授权并且工作正常:
credentials = AppAssertionCredentials(scope=['https://www.googleapis.com/auth/games', 'https://www.googleapis.com/auth/plus.login'])
http = credentials.authorize(httplib2.Http(memcache))
但我在尝试访问成就定义时遇到错误(也尝试获取应用程序元数据 - 遇到了同样的问题):
response = service.achievementDefinitions().list().execute()
在开发环境中我得到
<HttpError 404 when requesting https://www.googleapis.com/games/v1/achievements?alt=json returned "The requested application with ID 64436212345 was not found.">
在生产中:
<HttpError 500 when requesting https://www.googleapis.com/games/v1/achievements?alt=json returned "">
那里有什么问题? Google Play Services API 是否支持服务帐号?
更新。进一步分析表明,64436212345是我的GAE应用的ID,而我的Google Play应用的ID是760943112345。
因此,我前往 Google Developer Console 获取应用程序 760943112345,并将 64436212345-enq9gkd1abcdefghjec2kha39je5ojsc@developer.gserviceaccount.com 和 myappid@appspot.gserviceaccount.com 添加为他们的成员。它没有帮助。
然后我在那里生成了新的服务帐户 ID,并使用此服务帐户在本地运行 GAE。结果,我开始得到 p>
<HttpError 401 when requesting https://www.googleapis.com/games/v1/applications/760943112345?alt=json returned "User has not completed registration.">
当然,我的服务帐户没有 Google+ 个人资料。
【问题讨论】:
标签: google-app-engine google-api google-play-services google-play-games