Is it possible to access Google Play Game Services API with service account?

萝らか妹 提交于 2019-12-02 01:20:11

I am also struggling with service accounts and Google game services, and am stuck at the same point (my service account doesn't have a G+ account).

The only indication I have found in the Google literature (supposedly Updated Jan 22, 2014) says service accounts are not supported:

Warning: Very few Google APIs currently support Service Accounts. Service accounts are >currently supported by the following Google developer services:

  • Google Cloud Storage
  • Google Prediction API
  • Google URL Shortener
  • Google OAuth 2.0 Authorization Server
  • Google BigQuery

This is embedded in some google api php client documentation however, so I cannot attest its validity.

Let me know if you have any luck getting this to work and I'll do the same!

Edit: here is the actual answer: You have to create another API project and link it to your game's project, as explained in Getting Started with the Google Play Games Services Publishing API. The service accounts that you add to your game's project won't work. Also, you have to add this new API project through Google Play Developer Console, and not through Google Developers Console. As far as I remember, you go to the latter to get your key only. This whole situation took me forever to figure out.


I'm keeping the below text for future reference:

Edit: I wrote the answer below, thinking that you did not talk about the Publishing API. But you are, it seems. Or an earlier version of it. I hope the below answer will be useful for people looking to access Management API with a service account:

I struggled with the same and concluded that service accounts do not work with the GPGS Management API, which is the API that deals with achievements and things of that sort. Here are the facts that I used to reach this conclusion:

  • The only place in GPGS docs that service accounts are mentioned is the Publishing API.
  • Management API Docs contains descriptions for each function about the authorization requirements such as: "This method is only available to user accounts for your developer console.", while Publishing API Docs have no such descriptions.
  • The sample app for Management API does not use a service account.

It would be nice if this was a bit clearer in the GPGS docs. The generic Google Cloud docs that they link from GPGS pages made me believe that service accounts would work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!