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

# PFAuthenticationLoginWithFacebookRequest

> PFAuthenticationLoginWithFacebookRequest 数据模型。使用 Facebook 用户访问令牌完成 Facebook 登录。

PFAuthenticationLoginWithFacebookRequest 数据模型。使用 Facebook 用户访问令牌完成 Facebook 登录。有关该令牌的更多信息，请参阅 Facebook 开发人员文档 ([https://developers.facebook.com/docs/facebook-login/access-tokens/](https://developers.facebook.com/docs/facebook-login/access-tokens/))。例如，在 Unity 中，可从 Facebook SDK ScriptableObject FB 中的 AccessToken 获取该令牌。如果这是用户首次使用 Facebook 帐户登录且 CreateAccount 设为 true，将创建一个新的 PlayFab 帐户并链接到所提供帐户的 Facebook ID。在这种情况下，该 PlayFab 帐户将没有关联的电子邮件或用户名。否则，如果没有 PlayFab 帐户链接到该 Facebook 帐户，将返回相应的错误，以便游戏引导用户创建 PlayFab 帐户。请注意，游戏不应在不同的 PlayFab 游戏 ID 之间重复使用相同的 Facebook 应用程序，因为 Facebook 为每个应用程序提供唯一的用户 ID，这样做可能会导致玩家在其 PlayFab 帐户信息中的 Facebook ID 出现问题。如果必须在新的 PlayFab 游戏 ID 中重复使用某个应用程序，请务必先从 Facebook 取消所有帐户的链接，或删除第一个游戏 ID 中的所有用户。注意：如果用户使用 AuthenticationToken 而不是 AccessToken 进行身份验证，则 GetFriendsList API 将返回空列表。

## 语法

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

### 成员

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

Facebook 提供的用户的唯一标识符。

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

（可选）用于有限登录身份验证的令牌。

**`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 请求签名的玩家密钥（仅限企业版）。

## 要求

**头文件：** PFAuthenticationTypes.h

## 另请参阅

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


## Related topics

- [PFAuthenticationLoginWithFacebookAsync](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithfacebookasync.md)
- [PFAuthenticationReLoginWithFacebookAsync](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationreloginwithfacebookasync.md)
- [服务 C API 概览 - PFAuthenticationTypes.h](/zh-CN/services/playfab/api-references/c/pfauthenticationtypes/pfauthenticationtypes_members.md)
- [PlayFab Services C/C++ SDK 发行说明](/zh-CN/services/playfab/release-notes/playfab-c/index.md)
- [PFAuthenticationLoginWithFacebookGetResult](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithfacebookgetresult.md)
