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

# PFAuthenticationGetEntityAsync

> 将旧版 AuthenticationTicket 交换为实体令牌，或刷新 PlayFab 客户端 SDK 用于 API 调用的仍有效的实体令牌。

用于将旧版 AuthenticationTicket 或游戏 SecretKey 交换为实体令牌，或刷新仍有效的实体令牌的方法。

## 语法

```cpp theme={null}
HRESULT PFAuthenticationGetEntityAsync(  
    PFEntityHandle entityHandle,  
    const PFAuthenticationGetEntityRequest* request,  
    XAsyncBlock* async  
)  
```

### 参数

**`entityHandle`**   PFEntityHandle

用于身份验证的 PFEntityHandle。

**`request`**   [PFAuthenticationGetEntityRequest\*](/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationgetentityrequest)

已填充的请求对象。

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

用于异步操作的 XAsyncBlock。

### 返回值

类型：HRESULT

此 API 操作的结果代码。

## 备注

此 API 可在 Win32、Linux 和 macOS 上使用。调用此 API 时必须包含 X-SecretKey、X-Authentication 或 X-EntityToken 标头。可选择性地包含 EntityKey，以尝试将生成的 EntityToken 设置为特定实体，但该实体必须与调用方存在关系，例如角色的 master\_player\_account。如果发送 X-EntityToken，帐户将被标记为刚登录并颁发新令牌。如果使用 X-Authentication 或 X-EntityToken，标头必须仍然有效，不能已过期或已被吊销。异步任务完成后，调用 [PFAuthenticationGetEntityGetResult](/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationgetentitygetresult) 获取结果。

## 要求

**头文件：** PFAuthentication.h

## 另请参阅

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


## Related topics

- [PFAuthenticationGetEntityGetResult](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationgetentitygetresult.md)
- [服务 C API 概览 - PFAuthentication.h](/zh-CN/services/playfab/api-references/c/pfauthentication/pfauthentication_members.md)
- [PFAuthenticationGetEntityWithSecretKeyAsync](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationgetentitywithsecretkeyasync.md)
- [PFAuthenticationValidateEntityTokenAsync](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationvalidateentitytokenasync.md)
- [PFAuthenticationGetEntityWithSecretKeyGetResult](/zh-CN/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationgetentitywithsecretkeygetresult.md)
