アプリ切り替え

OAuth 2.0 を実装すると、必要に応じて認証ベースの App Flip を構成できます。これにより、ユーザーは認証システム内のアカウントを Google アカウントにすばやくリンクできます。以降のセクションでは、smart home アクションの App Flip を設計して実装する方法について説明します。

Design guidelines

This section describes the design requirements and recommendations for the App Flip account linking consent screen. After Google calls your app, your app displays the consent screen to the user.

Requirements

  1. You must have a Google authorization statement such as "Once linked, Google will have permission to control your devices."
  2. You must communicate that the user's account is being linked to Google, not to a specific Google product, such as Google Home or Google Assistant.
  3. You must state a clear call-to-action on your consent screen and use the wording "Agree and link" for linking action. This is because users need to understand what data they're required to share with Google to link their accounts.
  4. You must provide a way for users to go back or cancel, if they choose not to link. Use the wording "Cancel" for the cancel action.
  5. You must implement this workflow: After clicking "Agree and link", you must show linking success and redirect the user back to the Google Home app automatically. The user should now see the linked device on the Google Home app with your action. After clicking "Cancel" you should redirect the user back to the Google Home app.

Recommendations

We recommend that you do the following:

  1. Display Google's Privacy Policy. Include a link to Google's Privacy Policy on the consent screen.

  2. Data to be shared. Use clear and concise language to tell the user what data of theirs Google requires and why.

  3. Ability to unlink. Offer a mechanism for users to unlink, such as a URL to their account settings on your platform. Alternatively, you can include a link to Google Account where users can manage their linked account.

  4. Ability to change user account. Suggest a method for users to switch their account(s). This is especially beneficial if users tend to have multiple accounts.

    • If a user must close the consent screen to switch accounts, send a recoverable error to Google so the user can sign in to the desired account with OAuth linking and the implicit flow.
  5. Include your logo. Display your company logo on the consent screen. Use your style guidelines to place your logo. If you wish to also display Google's logo, see Logos and trademarks.

This figure shows an example consent screen with call-outs to the
            individual requirements and recommendations to be followed when
            you design a user consent screen.
Figure 1: Account linking consent screen design guidelines.

OAuth ベースの App Flip 用の設定

以降のセクションでは、OAuth ベースの App Flip の前提条件と、Actions Console で App Flip プロジェクトを構成する方法について説明します。

スマートホーム アクションを作成して OAuth 2.0 サーバーを設定する

App Flip を構成する前に、次のことを行う必要があります。

Actions Console で App Flip を構成する

次のセクションでは、Actions ConsoleApp Flip を構成する方法について説明します。

  1. [OAuth Client information] のすべてのフィールドを入力します(App Flip がサポートされていない場合は、通常の OAuth がフォールバックとして使用されます)。
  2. [Use your app for account linking (optional)] で、[Enable for iOS](iOS で有効にする)をオンにします。
  3. [Universal Link](ユニバーサル リンク)フィールドに入力します。ユニバーサル リンクについて詳しくは、アプリやウェブサイトのコンテンツへのリンクを許可するをご覧ください。
  4. クライアントを設定したい場合は、スコープを追加し、[Configure your client (optional)](クライアントを構成する(省略可))で [Add scope](スコープを追加)をクリックします。
  5. [保存] をクリックします。

次のセクションに進んで、iOS アプリまたは Android アプリに App Flip を実装できます。

ネイティブ アプリに App Flip を実装する

App Flip を実装するには、Google からのディープリンクを受け入れるように、アプリ内のユーザー認証コードを変更する必要があります。

デバイスで App Flip をテストする

アクションを作成し、コンソールとアプリで App Flip を構成したので、モバイル デバイスで App Flip をテストできます。Google Assistant app または Google Home app (GHA) を使用して App Flip をテストできます。

Google Assistant app から App Flip をテストするには、次の手順を行います。

  1. Actions Console に移動して、プロジェクトを選択します。
  2. 上部のナビゲーションで [Test](テスト)をクリックします。
  3. Google Assistant アプリからアカウントのリンクのフローをトリガーします。
    1. Google Assistant app を開きます。
    2. [設定] をクリックします。
    3. [Assistant] タブで、[スマートホーム] をクリックします。
    4. [追加(+)] をクリックします。
    5. プロバイダのリストからアクションを選択します。リストの先頭に「[test]」が付きます。リストから [test] アクションを選択する場合、アプリを開く必要があります。
    6. アプリが起動したことを確認し、承認フローのテストを開始します。

Google Home アプリから App Flip をテストする手順は次のとおりです。

  1. Actions Console に移動して、プロジェクトを選択します。
  2. 上部のナビゲーションで [Test](テスト)をクリックします。
  3. Home アプリからアカウントのリンクのフローをトリガーします。
    1. Google Home app (GHA) を開きます。
    2. [+] ボタンをクリックします。
    3. [デバイスのセットアップ] をクリックします。
    4. [セットアップ済みデバイスのリンク] をクリックします。
    5. プロバイダのリストから smart home アクションを選択します。リストの先頭に「[test]」が付きます。リストから [test] アクションを選択する場合、アプリを開く必要があります。
    6. アプリが起動したことを確認し、承認フローのテストを開始します。