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

# PartyXblManager::LoginToPlayFab

> Signs a user in to PlayFab with an XBOX Live token, asynchronously returning an Entity ID and Token for PlayFab API calls or PartyLocalUser creation.

Signs the user in to PlayFab using an XBOX Live token, asynchronously returning an Entity ID and Entity Token that can subsequently be used for PlayFab API calls which require an authenticated PlayFab user or to create a PartyLocalUser. There is no difference between calling this method or using the LoginWithXbox method provided by the PlayFab SDK.

## Syntax

```cpp theme={null}
PartyError LoginToPlayFab(  
    const PartyXblLocalChatUser* localChatUser,  
    void* asyncIdentifier  
)  
```

### Parameters

**`localChatUser`**   [PartyXblLocalChatUser\*](/services/playfab/multiplayer/networking/xblreference/classes/PartyXblLocalChatUser/partyxbllocalchatuser)

The local chat user object that will be used for the login operation.

**`asyncIdentifier`**   void\*\
*optional*

An optional, app-defined, pointer-sized context value that can be used to associate the completion state change with this call.

### Return value

PartyError

`c_partyErrorSuccess` if the operation to login the local chat user with PlayFab started or an error code otherwise. The human-readable form of the error code can be retrieved via [GetErrorMessage()](/services/playfab/multiplayer/networking/xblreference/classes/PartyXblManager/methods/partyxblmanager_geterrormessage).

## Remarks

If this is the first time the XBOX Live identity has logged in to PlayFab, a new PlayFab account will be created and linked to the XBOX Live identity. <br /><br /> When a token is nearing the expiration time or if a token has expired due to the application being in a dormant state for an extended time, a new token should be obtained by calling this method. It is recommended to acquire a new token when the previously supplied token is halfway through its validity period.

## Requirements

**Header:** PartyXboxLive.h

## See also

[PartyXblManager](/services/playfab/multiplayer/networking/xblreference/classes/PartyXblManager/partyxblmanager)\
[PartyXblLoginToPlayFabCompletedStateChange](/services/playfab/multiplayer/networking/xblreference/structs/partyxbllogintoplayfabcompletedstatechange)


## Related topics

- [PartyXblManager::GetEntityIdsFromXboxLiveUserIds](/services/playfab/multiplayer/networking/xblreference/classes/PartyXblManager/methods/partyxblmanager_getentityidsfromxboxliveuserids.md)
- [PlayFab Party XBOX Live Helper Release Notes](/services/playfab/multiplayer/networking/party-xboxlive-relnotes.md)
- [XBOX Live helper library for PlayFab Party](/services/playfab/multiplayer/networking/party-xbox-live-guide.md)
- [PartyXblXboxUserIdToPlayFabEntityIdMapping](/services/playfab/multiplayer/networking/xblreference/structs/partyxblxboxuseridtoplayfabentityidmapping.md)
- [PartyXblLoginToPlayFabCompletedStateChange](/services/playfab/multiplayer/networking/xblreference/structs/partyxbllogintoplayfabcompletedstatechange.md)
