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

# PFAuthenticationGetEntityAsync

> Exchange a legacy AuthenticationTicket or title SecretKey for an Entity Token, or refresh a still valid one, using a PFEntityHandle for authentication.

Method to exchange a legacy AuthenticationTicket or title SecretKey for an Entity Token or to refresh a still valid Entity Token.

## Syntax

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

### Parameters

**`entityHandle`**   PFEntityHandle

PFEntityHandle to use for authentication.

**`request`**   [PFAuthenticationGetEntityRequest\*](https://docs.xbox.com/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationgetentityrequest.md)

Populated request object.

**`async`**   XAsyncBlock\*\
*Inout*

XAsyncBlock for the async operation.

### Return value

Type: HRESULT

Result code for this API operation.

## Remarks

This API is available on Windows, Linux, and macOS. This API must be called with X-SecretKey, X-Authentication or X-EntityToken headers. The header must still be valid and cannot be expired or revoked.If successful, it will issue a new entity token and emit the 'entity\_logged\_in' PlayStream event. When the asynchronous task is complete, call [PFAuthenticationGetEntityGetResult](https://docs.xbox.com/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationgetentitygetresult.md) to get the result.

## Requirements

**Header:** PFAuthentication.h

## See also

[PFAuthentication members](https://docs.xbox.com/services/playfab/api-references/c/pfauthentication/pfauthentication_members.md)


## Related topics

- [PFAuthenticationGetEntityGetResult](https://docs.xbox.com/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationgetentitygetresult.md)
- [PlayFab Services C/C++ SDK Release Notes](https://docs.xbox.com/services/playfab/release-notes/playfab-c/index.md)
- [Services C API overview - PFAuthentication.h](https://docs.xbox.com/services/playfab/api-references/c/pfauthentication/pfauthentication_members.md)
- [PFAuthenticationGetEntityWithSecretKeyAsync](https://docs.xbox.com/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationgetentitywithsecretkeyasync.md)
- [PFAuthenticationValidateEntityTokenAsync](https://docs.xbox.com/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationvalidateentitytokenasync.md)
