PFAuthenticationLoginWithGooglePlayGamesServicesAsync

让用户使用其 Google Play Games 帐户凭据登录

语法

HRESULT PFAuthenticationLoginWithGooglePlayGamesServicesAsync(  
    PFServiceConfigHandle serviceConfigHandle,  
    const PFAuthenticationLoginWithGooglePlayGamesServicesRequest* request,  
    XAsyncBlock* async  
)  

参数

serviceConfigHandle PFServiceConfigHandle

从 PFServiceConfigCreateHandle 调用返回的 PFServiceConfigHandle。

request PFAuthenticationLoginWithGooglePlayGamesServicesRequest*

已填充的请求对象。

async XAsyncBlock*
Inout

异步操作的 XAsyncBlock。

返回值

类型:HRESULT

此 API 操作的结果代码。

备注

此 API 在 Android 上可用。 Google Play Games 登录是通过使用设备上 Android API 的 Google Play Games 登录获取 Google OAuth 2.0 凭据并将其传递给此 API 来实现的。 如果这是用户首次使用 Google Play Games 登录,并且 CreateAccount 设置为 true,则将创建新的 PlayFab 帐户并将其链接到 Google Play Games 帐户。 否则,如果没有 PlayFab 帐户链接到 Google Play Games 帐户,则会返回一个错误,指示将返回此帐户,以便游戏可以指导用户完成 PlayFab 帐户的创建。 在 Android 应用程序中获取 Google Play Games 帐户凭据的当前(推荐)方法是调用 GamesSignInClient.requestServerSideAccess() 并将身份验证代码作为此 API 的 ServerAuthCode 参数发送。 执行此操作之前,必须在 Google API 控制台中创建 OAuth 2.0 Web 应用程序客户端 ID,并在 PlayFab Game Manager Google 加载项中为游戏配置其客户端 ID 和机密。 此方法不需要提示用户提供其他 Google 帐户权限,从而使得用户体验出现尽可能少的摩擦。 有关获取服务器身份验证代码的详细信息,请参阅 https://developers.google.com/games/services/android/signin。 异步任务完成后,调用 PFAuthenticationLoginWithGooglePlayGamesServicesGetResult 获取结果。

要求

标头:PFAuthentication.h

另请参阅

PFAuthentication 成员