概要

OAuth-based App Flip Linking (App Flip) allows your users to easily and quickly link their accounts in your authentication system to their Google accounts. If your app is installed on your user’s phone when they initiate the account linking process, they are seamlessly flipped to your app to obtain user authorization.

This approach provides a faster and easier linking process since the user does not have to re-enter their username and password to authenticate; instead, App Flip leverages the credentials from the user's account on your app. Once a user has linked their Google account with your app, they can take advantage of any integrations that you have developed.

You can set up App Flip for both iOS and Android apps.

This figure shows the steps for a user to link their Google account
            to your authentication system. The first screenshot shows how a user
            can select your app if their Google account is linked to your app.
            The second screenshot shows the confirmation for linking their
            Google account with your app. The third screenshot shows a
            successfully linked user account in the Google app.
Figure 1. Account linking on a user's phone with App Flip.

Requirements

To implement App Flip, you must fulfill the following requirements:

  • You must have an Android or iOS app.
  • You must own, manage and maintain an OAuth 2.0 server which supports the OAuth 2.0 authorization code flow.

OAuth リンクの認証コードフローの詳細については、OAuth サーバーを実装するをご覧ください。

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 communicate that the user’s account is being linked to Google, not to a specific Google product, such as Google Home or Google Assistant.

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. Clear call-to-action. State a clear call-to-action on your consent screen, such as “Agree and link.” This is because users need to understand what data they're required to share with Google to link their accounts.

  4. Ability to deny or cancel. Provide a way for users to go back, deny, or cancel, if they choose not to link.

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

  6. 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.
  7. 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 2. Account linking consent screen design guidelines.

OAuth ベースのアプリ切り替えを設定する

以下のセクションでは、OAuth ベースのアプリ切り替えの前提条件と、アプリ切り替えプロジェクトを Actions Console で設定する方法について説明します。

アクションを作成して OAuth 2.0 サーバーを設定する

アプリ切り替えを設定する前に、以下を行う必要があります。

Actions Console でアプリ切り替えを設定する

次のセクションでは、Actions Console でアプリ切り替えを構成する方法を説明します。

  1. 上部のナビゲーションにある [Develop](開発)をクリックし、左側のナビゲーションで [Account linking](アカウントのリンク)をクリックします。
  2. [アカウントのリンク] の横にあるスイッチをオンにします。
  3. [Account creation](アカウントの作成)で、[No, I only want to allow account creation on my website](いいえ、自分のウェブサイトでのアカウントの作成のみを許可します)を選択します。
  4. [次へ] をクリックします。
  5. [Linking type](リンクタイプ)で、[OAuth] と [Authorization code](認証コード)を選択します。
  6. [次へ] をクリックします。
  7. [OAuth Client information] のすべてのフィールドを入力します。(アプリ切り替えがサポートされていない場合は、通常の OAuth がフォールバックとして使用されます)。
  8. [次へ] をクリックします。
  9. [Use your app for account linking (optional)] で、[Enable for iOS](iOS で有効にする)をオンにします。
  10. [Universal Link](ユニバーサル リンク)フィールドに入力します。ユニバーサル リンクについて詳しくは、コンテンツへのアプリとウェブサイトのリンクを許可する をご覧ください。
  11. クライアントを設定したい場合は、スコープを追加し、[Configure your client (optional)](クライアントを構成する(省略可))で [Add scope](スコープを追加)をクリックします。構成しない場合は、[次へ] をクリックします。
  12. [Testing instructions](テスト手順)で、プレースホルダとして「test」(または任意の文字列)を入力します。(テスト アカウントでこのフィールドを入力する必要があるのは、実際にアクションを提出して公開する場合のみです)。
  13. [保存] をクリックします。

次のセクションでは、iOS アプリまたは Android アプリにアプリ切り替えを実装します。

ネイティブ アプリにアプリ切り替えを実装する

アプリ切り替えを実装するには、Google からのディープリンクを許可するようにアプリのユーザー認可コードを変更する必要があります。

デバイスでアプリ切り替えをテストする

アクションを作成し、コンソールとアプリでアプリ切り替えを設定したら、モバイル デバイスでアプリ切り替えをテストできます。Google アシスタント アプリを使ってアプリ切り替えをテストすることもできます。

アシスタント アプリからアプリ切り替えをテストする手順は次のとおりです。

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