總覽

使用 OAuth 的應用程式翻轉連結功能 (應用程式翻轉),可讓使用者輕鬆快速地將驗證系統中的帳戶連結至 Google 帳戶。如果使用者在啟動帳戶連結程序時,已在手機上安裝您的應用程式,系統會順暢地將他們轉送至您的應用程式,以取得使用者授權。

這種做法可提供更快速、更簡便的連結程序,因為使用者不必重新輸入使用者名稱和密碼來進行驗證;相反地,App Flip 會利用使用者帳戶在應用程式中的憑證。一旦使用者將 Google 帳戶連結至您的應用程式,就能利用您開發的任何整合功能。

您可以為 iOS 和 Android 應用程式設定應用程式快速連結。

這張圖片顯示使用者將 Google 帳戶連結至驗證系統的步驟。第一張螢幕截圖顯示,如果使用者的 Google 帳戶已連結至您的應用程式,他們可以如何選取您的應用程式。第二張螢幕截圖顯示,使用者如何確認將 Google 帳戶連結至您的應用程式。第三張螢幕截圖顯示,使用者已成功在 Google 應用程式中連結帳戶。
圖 1. 使用 App Flip 在使用者的手機上連結帳戶。

需求條件

如要導入應用程式翻轉功能,您必須符合下列規定:

  • 您必須擁有 Android 或 iOS 應用程式。
  • 您必須擁有、管理及維護支援 OAuth 2.0 授權碼流程的 OAuth 2.0 伺服器。

如要進一步瞭解 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 控制台中設定應用程式切換專案。

建立動作並設定 OAuth 2.0 伺服器

設定應用程式切換功能前,請先完成下列事項:

  • 建立動作。如要建立動作,請按照「建立專案」一節的指示操作。
  • 設定 OAuth 2.0 伺服器。如要進一步瞭解如何設定 OAuth 伺服器,請參閱「實作 OAuth 帳戶連結」。

在 Actions 控制台中設定應用程式切換

下一節說明如何在 Actions 控制台中設定應用程式切換功能。

  1. 按一下頂端導覽列中的「開發」。然後按一下左側導覽中的「帳戶連結」
  2. 將「帳戶連結」旁邊的切換鈕設為開啟。
  3. 在「帳戶建立」下方,選取「否,我只想允許在我的網站上建立帳戶」
  4. 點選 [下一步]。
  5. 在「連結類型」下方,從下拉式選單中選取「OAuth」和「授權碼」
  6. 按一下「繼續」。
  7. 填寫「OAuth 用戶端資訊」下方的所有欄位。 (如果系統不支援應用程式切換,會改用一般 OAuth)。
  8. 點選 [下一步]。
  9. 在「使用應用程式連結帳戶 (選用)」下方,勾選「為 iOS 啟用」
  10. 填寫「通用連結」欄位。如要進一步瞭解通用連結,請參閱「允許應用程式和網站連結至您的內容 」。
  11. 如要視需要設定用戶端,請新增範圍,然後按一下「設定用戶端 (選用)」下方的「新增範圍」。 如果沒有,請按一下「下一步」
  12. 在「測試說明」下方,輸入 test (或其他任何字串) 做為預留位置。(只有在您實際提交要發布的動作時,才需要填寫這個欄位。)
  13. 按一下 [儲存]

現在可以繼續前往下一節,在 iOS 或 Android 應用程式中導入 App Flip。

在原生應用程式中導入 App Flip

如要導入應用程式切換功能,您必須修改應用程式中的使用者授權碼,接受來自 Google 的深層連結。

在裝置上測試應用程式切換功能

您已在管理中心和應用程式中建立動作並設定應用程式切換功能,現在可以在行動裝置上測試這項功能。您可以使用 Google 助理應用程式測試應用程式切換功能。

如要透過 Google 助理應用程式測試應用程式切換功能,請按照下列步驟操作:

  1. 前往 Actions 控制台,然後選取專案。
  2. 按一下頂端導覽列中的「測試」
  3. 從 Google 助理應用程式觸發帳戶連結流程:
    1. 開啟 Google 助理應用程式
    2. 按一下 [設定]。
    3. 在「Google 助理」分頁中,按一下「居家控制系統」
    4. 按一下「新增」(+)
    5. 從供應商清單中選取所需動作。清單中會以「[測試]」為前置字元。從清單中選取 [測試] 動作時,應用程式應會開啟。
    6. 確認應用程式已啟動,並開始測試授權流程。