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

# PFAuthenticationLoginWithFacebookAsync

> Facebook アクセス トークンを使用してユーザーをサインインさせ、以降認証済みユーザーを必要とする API 呼び出しに使用できるセッション識別子を返します。

Facebook アクセス トークンを使用してユーザーをサインインさせ、以降認証済みユーザーを必要とする API 呼び出しに使用できるセッション識別子を返します。

## 構文

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

### パラメーター

**`serviceConfigHandle`**   PFServiceConfigHandle

PFServiceConfigCreateHandle 呼び出しから返される PFServiceConfigHandle。

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

値が設定されたリクエスト オブジェクト。

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

非同期操作用の XAsyncBlock。

### 戻り値

型: HRESULT

この API 操作の結果コード。

## 解説

この API は Android と iOS で利用できます。Facebook サインインは Facebook User Access Token を使用して行われます。トークンの詳細については、Facebook 開発者ドキュメント ([https://developers.facebook.com/docs/facebook-login/access-tokens/](https://developers.facebook.com/docs/facebook-login/access-tokens/)) を参照してください。たとえば Unity では、Facebook SDK の ScriptableObject FB の AccessToken としてトークンを利用できます。ユーザーが初めて Facebook アカウントでサインインし、CreateAccount が true に設定されている場合、新しい PlayFab アカウントが作成され、提供されたアカウントの Facebook ID にリンクされます。この場合、その PlayFab アカウントにはメール アドレスもユーザー名も関連付けられません。Facebook アカウントにリンクされた PlayFab アカウントがない場合はそれを示すエラーが返されるため、タイトルはユーザーを PlayFab アカウントの作成に誘導できます。Facebook はアプリケーションごとに一意のユーザー ID を提供するため、タイトルは同じ Facebook アプリケーションを PlayFab タイトル ID 間で再利用してはいけません。再利用すると、その PlayFab アカウント情報内のユーザーの Facebook ID に問題が発生する可能性があります。新しい PlayFab タイトル ID でアプリケーションを再利用する必要がある場合は、まずすべてのアカウントを Facebook からリンク解除するか、最初のタイトル ID のすべてのユーザーを削除してください。注: ユーザーが AccessToken ではなく AuthenticationToken で認証されている場合、GetFriendsList API は空のリストを返します。ClientLinkFacebookAccountAsync、ClientUnlinkFacebookAccountAsync も参照してください。非同期タスクが完了したら、[PFAuthenticationLoginWithFacebookGetResult](/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithfacebookgetresult) を呼び出して結果を取得します。

## 要件

**ヘッダー:** PFAuthentication.h

## 関連項目

[PFAuthentication のメンバー](/services/playfab/api-references/c/pfauthentication/pfauthentication_members)


## Related topics

- [PFAuthenticationLoginWithFacebookGetResult](/ja-jp/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithfacebookgetresult.md)
- [PFAuthenticationLoginWithFacebookGetResultSize](/ja-jp/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithfacebookgetresultsize.md)
- [Services C API overview - PFAuthentication.h](/ja-jp/services/playfab/api-references/c/pfauthentication/pfauthentication_members.md)
- [PFAuthenticationReLoginWithFacebookAsync](/ja-jp/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationreloginwithfacebookasync.md)
- [PFAuthenticationLoginWithFacebookRequest](/ja-jp/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationloginwithfacebookrequest.md)
