Google Account Linking with OAuth-based App Flip

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.

设计准则

本部分介绍了 App Flip 账号关联意见征求界面的设计要求和建议。Google 调用您的应用后,应用会向用户显示同意屏幕。

要求

  1. 您必须说明用户的账号将与 Google 相关联,而不是与特定 Google 产品(例如 Google Home 或 Google 助理)相关联。

建议

建议您执行以下操作:

  1. 显示 Google 的隐私权政策。在同意屏幕上添加指向 Google 隐私权政策的链接。

  2. 要分享的数据。使用简洁明了的语言告知用户 Google 需要哪些数据以及为何需要这些数据。

  3. 明确的号召性用语。在用户同意页面上提供明确的号召性用语,例如“同意并关联”。这是因为用户需要了解他们需要与 Google 分享哪些数据才能关联账号。

  4. 能够取消。为用户提供返回或取消链接的途径,如果用户选择不进行关联。

  5. 能够解除关联。提供一种供用户解除关联的机制,例如指向他们在您的平台上账号设置的网址。或者,您也可以添加指向 Google 账号的链接,以便用户管理其关联的账号。

  6. 能够更改用户账号。建议用户切换账号的方法。如果用户通常拥有多个账号,这种做法尤为有益。

    • 如果用户必须关闭意见征求界面才能切换账号,请向 Google 发送可恢复的错误,以便用户可以使用 OAuth 关联隐式流程登录所需的账号。
  7. 添加您的徽标。在同意屏幕上显示您的公司徽标。 按照您的样式准则放置徽标。如果您还想显示 Google 的徽标,请参阅徽标和商标

此图显示了同意页面的示例,其中突出显示了设计用户意见征求页面时应遵循的具体要求和建议。
图 2. 账号关联意见征求界面设计指南。

Implement App Flip in your native apps

To implement App Flip, you need to modify the user authorization code in your app to accept a deep link from Google.

To support App Flip on your Android app, follow the instructions on the Android implementation guide.

To support App Flip on your iOS app, follow the instructions on the iOS implementation guide.

Test App Flip

App Flip may be simulated using sample and test apps before verified production apps and a working OAuth 2.0 server are available.

During App Flip a Google app will first open your app which then requests an authorization code response from your OAuth 2.0 server, in the final step the response is returned to the Google app.

Prerequisites

To simulate a Google app and trigger the intent which launches your app, download and install the App Flip Test Tool for Android and iOS.

Download and install the App Flip Sample for Android and iOS To simulate your app and select an OAuth 2.0 response type.

Test sequence

  1. Open the App Flip Test Tool.
  2. Press Try Flip! to launch your App Flip Sample app.
  3. Select a response from the radio buttons in the Sample app.
  4. Press Send to return a simulated OAuth 2.0 response back to the Test Tool.
  5. Check the Test Tool log messages for an auth_code or error details.

Production testing

App Flip may be tested in production after completing registration and your OAuth 2.0 server implementation.

A single Google Account and a task specific email address are recommended for automated testing.

Accounts linking state can be viewed using Linked accounts when signed in as the Google Account holder. Accounts may be unlinked between repeated tests from here as well.

Optionally, you may choose to implement RISC to programmatically unlink and notify Google of the change.