> ## 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.

# PFAuthenticationLoginWithGooglePlayGamesServicesRequest

> PFAuthenticationLoginWithGooglePlayGamesServicesRequest 数据模型。通过获取 Google OAuth 2.0 凭据来完成 Google Play Games 登录。

PFAuthenticationLoginWithGooglePlayGamesServicesRequest 数据模型。通过使用设备上的 Google Play Games Android 版登录 API 获取 Google OAuth 2.0 凭据并将其传递给此 API，可完成 Google Play Games 登录。如果这是用户首次使用 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](https://developers.google.com/games/services/android/signin)。

## 语法

```cpp theme={null}
typedef struct PFAuthenticationLoginWithGooglePlayGamesServicesRequest {  
    bool createAccount;  
    PFStringDictionaryEntry const* customTags;  
    uint32_t customTagsCount;  
    PFGetPlayerCombinedInfoRequestParams const* infoRequestParameters;  
    const char* playerSecret;  
    const char* serverAuthCode;  
} PFAuthenticationLoginWithGooglePlayGamesServicesRequest;  
```

### 成员

**`createAccount`**   bool

如果当前没有 PlayFab 帐户链接到此 ID，则自动创建一个。

**`customTags`**   PFStringDictionaryEntry const\*<br />*may be nullptr*

（可选）与请求关联的可选自定义标记（例如生成号、外部跟踪标识符等）。

**`customTagsCount`**   uint32\_t

customTags 的数量

**`infoRequestParameters`**   PFGetPlayerCombinedInfoRequestParams const\*<br />*may be nullptr*

（可选）标志，指示要为该用户返回哪些信息。

**`playerSecret`**   const char\*<br />*is null-terminated*

（可选）用于验证 API 请求签名的玩家密钥（仅限企业版）。

**`serverAuthCode`**   const char\*<br />*is null-terminated*

通过调用 requestServerSideAccess() ([https://developers.google.com/games/services/android/signin](https://developers.google.com/games/services/android/signin)) Google Play Games 客户端 API 在客户端上获取的 OAuth 2.0 服务器身份验证代码。

## 要求

**头文件：** PFAuthenticationTypes.h

## 另请参阅

[PFAuthenticationTypes 成员](/services/playfab/api-references/c/pfauthenticationtypes/pfauthenticationtypes_members)


## Related topics

- [PFAuthenticationLoginWithGooglePlayGamesServicesAsync](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgoogleplaygamesservicesasync.md)
- [PFAuthenticationReLoginWithGooglePlayGamesServicesAsync](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationreloginwithgoogleplaygamesservicesasync.md)
- [服务 C API 概览 - PFAuthenticationTypes.h](/zh-CN/services/playfab/api-references/c/pfauthenticationtypes/pfauthenticationtypes_members.md)
- [PFAuthenticationLoginWithGooglePlayGamesServicesGetResult](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgoogleplaygamesservicesgetresult.md)
- [PFAuthenticationLoginWithGooglePlayGamesServicesGetResultSize](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgoogleplaygamesservicesgetresultsize.md)
