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

# PFAuthenticationServerLoginWithXboxAsync

> 從外部伺服器後端使用 XBOX Live 權杖將使用者登入，傳回可在後續用於 API 呼叫的工作階段識別碼。

從外部伺服器後端使用 XBOX Live 權杖將使用者登入，傳回可在後續用於需要已驗證使用者之 API 呼叫的工作階段識別碼

## 語法

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

### 參數

**`serviceConfigHandle`**   PFServiceConfigHandle

從 PFServiceConfigCreateHandle 呼叫傳回的 PFServiceConfigHandle。

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

用於驗證服務要求的遊戲祕密金鑰。

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

已填入的要求物件。

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

用於非同步作業的 XAsyncBlock。

### 傳回值

類型：HRESULT

此 API 作業的結果代碼。

## 備註

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

## 需求

**標頭：** PFAuthentication.h

## 另請參閱

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


## Related topics

- [PFAuthenticationServerLoginWithXboxGetResultSize](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithxboxgetresultsize.md)
- [PFAuthenticationServerLoginWithXboxGetResult](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithxboxgetresult.md)
- [服務 C API 概觀 - PFAuthentication.h](/zh-TW/services/playfab/api-references/c/pfauthentication/pfauthentication_members.md)
- [PFAuthenticationServerLoginWithXboxIdAsync](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithxboxidasync.md)
- [PFAuthenticationServerLoginWithPSNAsync](/zh-TW/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationserverloginwithpsnasync.md)
