用于安卓系统的Google的在线参考文献显示了Games类的公共方法摘要,其中包括:
static PendingResult<Games.GetTokenResult> getGamesAuthToken(GoogleApiClient apiClient)但是最新的版本(8.4.0)并不包括此方法。我使用这个来获取API:
dependencies {
compile 'com.google.android.gms:play-services:8.4.0'
}Games.getGamesAuthToken在哪里?
发布于 2016-03-31 18:01:08
这实际上是一个文档问题。getGamesAuthToken()已经被删除,因为它不像需要的那样安全。
作为参考,您可以阅读http://android-developers.blogspot.com/2016/01/play-games-permissions-are-changing-in.html
处理此问题的最佳方法是:
在设备上验证播放机之后:
GetServerAuthCodeResult result = Games.getGamesServerAuthCode(gac, clientId).await(); if (result.isSuccess()) { String authCode = result.getCode(); // Send code to server. }https://www.googleapis.com/oauth2/v4/token,将接收到的auth代码交换为访问令牌。您必须提供服务器客户端ID、服务器客户端机密(在创建服务器客户端ID时列出在开发人员控制台中)和auth代码。请参阅这里的更多细节:medium=blog#handlingresponse。www.googleapis.com/games/v1/applications/<app_id>/verify/使用访问令牌检索播放机的ID。在标题中传递auth令牌,如下所示:“授权: OAuth”
响应值将包含用户的播放器ID。这是要用于此用户的正确的播放器ID。此访问令牌可用于根据需要进行额外的服务器到服务器调用。https://stackoverflow.com/questions/36307111
复制相似问题