> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PFAuthenticationLoginWithGooglePlayGamesServicesAsync

> 使用使用者的 Google Play Games 帳戶認證將使用者登入

使用使用者的 Google Play Games 帳戶認證將使用者登入

## 語法

```cpp theme={null}
HRESULT PFAuthenticationLoginWithGooglePlayGamesServicesAsync(  
    PFServiceConfigHandle serviceConfigHandle,  
    const PFAuthenticationLoginWithGooglePlayGamesServicesRequest* request,  
    XAsyncBlock* async  
)  
```

### 參數

**`serviceConfigHandle`**   PFServiceConfigHandle

從 PFServiceConfigCreateHandle 呼叫傳回的 PFServiceConfigHandle。

**`request`**   [PFAuthenticationLoginWithGooglePlayGamesServicesRequest\*](/zh-TW/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationloginwithgoogleplaygamesservicesrequest)

已填入資料的要求物件。

**`async`**   XAsyncBlock\*<br />*Inout*

用於非同步作業的 XAsyncBlock。

### 傳回值

類型：HRESULT

此 API 作業的結果代碼。

## 備註

此 API 可在 Android 上使用。Google Play Games 登入的完成方式為：在裝置上使用 Google Play Games sign-in for Android API 取得 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 Console 中建立 OAuth 2.0 Web 應用程式用戶端識別碼，並在遊戲的 PlayFab Game Manager Google 附加元件中設定其用戶端識別碼和密碼。此方法不需要提示使用者授予額外的 Google 帳戶權限，因此能提供最流暢的使用者體驗。如需取得伺服器驗證碼的詳細資訊，請參閱 [https://developers.google.com/games/services/android/signin](https://developers.google.com/games/services/android/signin)。非同步工作完成時，請呼叫 [PFAuthenticationLoginWithGooglePlayGamesServicesGetResult](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgoogleplaygamesservicesgetresult) 以取得結果。

## 需求

**標頭：** PFAuthentication.h

## 另請參閱

[PFAuthentication 成員](/zh-TW/services/playfab/api-references/c/pfauthentication/pfauthentication_members)


## Related topics

- [PFAuthenticationLoginWithGooglePlayGamesServicesGetResultSize](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgoogleplaygamesservicesgetresultsize.md)
- [PFAuthenticationLoginWithGooglePlayGamesServicesGetResult](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgoogleplaygamesservicesgetresult.md)
- [服務 C API 概觀 - PFAuthentication.h](/zh-TW/services/playfab/api-references/c/pfauthentication/pfauthentication_members.md)
- [PFAuthenticationReLoginWithGooglePlayGamesServicesAsync](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationreloginwithgoogleplaygamesservicesasync.md)
- [PFAuthenticationLoginWithGooglePlayGamesServicesRequest](/zh-TW/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationloginwithgoogleplaygamesservicesrequest.md)
