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

# PFAuthenticationServerLoginWithCustomIDAsync

> 使用游戏生成的自定义唯一标识符为用户登录，并返回会话标识符，该标识符随后可用于需要经过身份验证的用户的 API 调用

使用游戏生成的自定义唯一标识符为用户登录，并返回会话标识符，该标识符随后可用于需要经过身份验证的用户的 API 调用

## 语法

```cpp theme={null}
HRESULT PFAuthenticationServerLoginWithCustomIDAsync(  
    PFServiceConfigHandle serviceConfigHandle,  
    const char* secretKey,  
    const PFAuthenticationServerLoginWithCustomIDRequest* request,  
    XAsyncBlock* async  
)  
```

### 参数

**`serviceConfigHandle`**   PFServiceConfigHandle

从 PFServiceConfigCreateHandle 调用返回的 PFServiceConfigHandle。

**`secretKey`**   char\*<br />*In\_z*

用于对服务请求进行身份验证的游戏密钥。

**`request`**   [PFAuthenticationServerLoginWithCustomIDRequest\*](/zh-CN/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationserverloginwithcustomidrequest)

已填充的请求对象。

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

用于异步操作的 XAsyncBlock。

### 返回值

类型：HRESULT

此 API 操作的结果代码。

## 备注

此 API 可在 Windows 上使用。强烈建议开发人员确保客户生成已被其他客户使用的 ID 的可能性极低。如果这是用户首次使用该自定义 ID 登录，并且 CreateAccount 设置为 true，则会创建一个新的 PlayFab 账户并将其关联到该自定义 ID。在这种情况下，不会有电子邮件或用户名与该 PlayFab 账户关联。否则，如果没有 PlayFab 账户关联到该自定义 ID，将返回指示此情况的错误，以便游戏可以引导用户创建 PlayFab 账户。异步任务完成后，调用 [PFAuthenticationServerLoginWithCustomIDGetResult](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithcustomidgetresult) 获取结果。

## 要求

**头文件：** PFAuthentication.h

## 另请参阅

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


## Related topics

- [PFAuthenticationServerLoginWithCustomIDGetResultSize](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithcustomidgetresultsize.md)
- [PFAuthenticationServerLoginWithCustomIDGetResult](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithcustomidgetresult.md)
- [PFAuthenticationServerLoginWithServerCustomIdAsync](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithservercustomidasync.md)
- [PFAuthenticationServerLoginWithServerCustomIdGetResult](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithservercustomidgetresult.md)
- [PFAuthenticationServerLoginWithServerCustomIdGetResultSize](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithservercustomidgetresultsize.md)
