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

# PFAuthenticationLoginWithXUserAsync

> 使用 XUserHandle 將使用者登入，並傳回工作階段識別碼，之後可用於需要已驗證使用者的 API 呼叫

使用 XUserHandle 將使用者登入，並傳回工作階段識別碼，之後可用於需要已驗證使用者的 API 呼叫

## 語法

```cpp theme={null}
HRESULT PFAuthenticationLoginWithXUserAsync(  
    PFServiceConfigHandle serviceConfigHandle,  
    const PFAuthenticationLoginWithXUserRequest* request,  
    XAsyncBlock* async  
)  
```

### 參數

**`serviceConfigHandle`**   PFServiceConfigHandle

從 PFServiceConfigCreateHandle 呼叫傳回的 PFServiceConfigHandle。

**`request`**   [PFAuthenticationLoginWithXUserRequest\*](/zh-TW/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationloginwithxuserrequest)

已填入資料的要求物件。

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

用於非同步作業的 XAsyncBlock。

### 傳回值

類型：HRESULT

此 API 作業的結果代碼。

## 備註

此 API 可在 GDK 上使用。如果這是使用者第一次以 XBOX Live 帳戶登入，且 CreateAccount 設為 true，系統將建立新的 PlayFab 帳戶，並將其連結至該 XBOX Live 帳戶。在此情況下，PlayFab 帳戶不會與任何電子郵件或使用者名稱相關聯。否則，如果沒有任何 PlayFab 帳戶連結至該 XBOX Live 帳戶，將會傳回表示此情況的錯誤，讓遊戲可以引導使用者建立 PlayFab 帳戶。另請參閱 ClientLinkXboxAccountAsync、ClientUnlinkXboxAccountAsync。非同步工作完成時，請呼叫 [PFAuthenticationLoginWithXUserGetResult](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithxusergetresult) 以取得結果。

## 需求

**標頭：** PFAuthentication\_Xbox.h

## 另請參閱

[PFAuthentication\_Xbox 成員](/zh-TW/services/playfab/api-references/c/pfauthentication/pfauthentication_members)


## Related topics

- [PFAuthenticationLoginWithXUserGetResultSize](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithxusergetresultsize.md)
- [PFAuthenticationLoginWithXUserGetResult](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithxusergetresult.md)
- [PFAuthenticationLoginWithXboxAsync](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithxboxasync.md)
- [PFAuthenticationLoginWithXUserRequest](/zh-TW/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationloginwithxuserrequest.md)
- [快速入門 (Windows) - Core SDK 設定](/zh-TW/services/playfab/sdks/unified-sdk/quickstart-core.md)
