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

# PFAuthenticationLoginWithGoogleAccountAsync

> Google アカウントの資格情報を使用してユーザーをサインインさせます。

Google アカウントの資格情報を使用してユーザーをサインインさせます。

## 構文

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

### パラメーター

**`serviceConfigHandle`**   PFServiceConfigHandle

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

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

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

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

非同期操作用の XAsyncBlock。

### 戻り値

型: HRESULT

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

## 解説

この API は Android で利用できます。Google サインインは、デバイス上の Google Sign-In for Android API を使用して Google OAuth 2.0 資格情報を取得し、この API に渡すことで行われます。ユーザーが初めて Google アカウントでサインインし、CreateAccount が true に設定されている場合、新しい PlayFab アカウントが作成され、その Google アカウントにリンクされます。Google アカウントにリンクされた PlayFab アカウントがない場合はそれを示すエラーが返されるため、タイトルはユーザーを PlayFab アカウントの作成に誘導できます。Android アプリケーションで Google アカウント資格情報を取得する現在の (推奨される) 方法は、GoogleSignInAccount.getServerAuthCode() を呼び出し、取得した認証コードをこの API の ServerAuthCode パラメーターとして送信することです。これを行う前に、Google API Console で OAuth 2.0 Web アプリケーションのクライアント ID を作成し、そのクライアント ID とシークレットをタイトルの PlayFab Game Manager Google アドオンに構成する必要があります。この方法はユーザーに追加の Google アカウント権限を要求する必要がないため、可能な限り摩擦の少ないユーザー エクスペリエンスを実現します。サーバー認証コードの取得の詳細については、[https://developers.google.com/identity/sign-in/android/offline-access](https://developers.google.com/identity/sign-in/android/offline-access) を参照してください。以前の (非推奨の) 方法は、クライアントで GetAccessToken() を呼び出して OAuth アクセス トークンを取得し、この API の AccessToken パラメーターとして渡して Google OAuth 2.0 アクセス トークンを使用する方法でした。この変更の詳細については、Google 開発者ドキュメント ([https://android-developers.googleblog.com/2016/01/play-games-permissions-are-changing-in.html](https://android-developers.googleblog.com/2016/01/play-games-permissions-are-changing-in.html)) を参照してください。非同期タスクが完了したら、[PFAuthenticationLoginWithGoogleAccountGetResult](/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgoogleaccountgetresult) を呼び出して結果を取得します。

## 要件

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

## 関連項目

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


## Related topics

- [PFAuthenticationLoginWithGoogleAccountGetResult](/ja-jp/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgoogleaccountgetresult.md)
- [PFAuthenticationLoginWithGoogleAccountGetResultSize](/ja-jp/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationloginwithgoogleaccountgetresultsize.md)
- [Services C API overview - PFAuthentication.h](/ja-jp/services/playfab/api-references/c/pfauthentication/pfauthentication_members.md)
- [PFAuthenticationReLoginWithGoogleAccountAsync](/ja-jp/services/playfab/api-references/c/pfauthentication/functions/pfauthenticationreloginwithgoogleaccountasync.md)
- [PFAuthenticationLoginWithGoogleAccountRequest](/ja-jp/services/playfab/api-references/c/pfauthenticationtypes/structs/pfauthenticationloginwithgoogleaccountrequest.md)
