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.
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
- 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:
Display Google's Privacy Policy. Include a link to Google’s Privacy Policy on the consent screen.
Data to be shared. Use clear and concise language to tell the user what data of theirs Google requires and why.
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.
Ability to cancel. Provide a way for users to go back or cancel, if they choose not to link.
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.
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.
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.
設定以 OAuth 為基礎的應用程式翻轉
以下各節將說明以 OAuth 為基礎的應用程式翻轉的先決條件,以及如何在 Actions 控制台中設定應用程式 Flip 專案。
建立動作並設定 OAuth 2.0 伺服器
您必須先完成下列步驟,才能設定應用程式翻轉功能:
- 建立動作。如要建立動作,請按照「建立專案」一節中的指示操作。
- 設定 OAuth 2.0 伺服器。如要進一步瞭解如何設定 OAuth 伺服器,請參閱「實作 OAuth 帳戶連結」。
在動作主控台中設定應用程式翻轉
以下章節說明如何在動作控制台中設定應用程式翻轉。
- 按一下頂端導覽列中的「Develop」。然後按一下左側導覽面板中的「帳戶連結」。
- 將「帳戶連結」旁的切換按鈕設為開啟。
- 在「建立帳戶」下方,選取「否,我只想允許在我的網站上建立帳戶」。
- 按一下「Next」。
- 在「連結類型」下方的下拉式選單中,選取「OAuth」和「授權碼」。
- 按一下「繼續」。
- 填寫「OAuth 用戶端資訊」下方的所有欄位。(如果不支援 App Flip,系統會將一般 OAuth 做為備用選項)。
- 按一下「Next」。
- 在「使用您的應用程式進行帳戶連結 (選用)」下方,勾選「為 iOS 啟用」。
- 填寫「通用連結」欄位。如要進一步瞭解通用連結,請參閱「允許應用程式和網站與您的內容連結 」一文。
- 如果您想選擇用戶端設定,請新增範圍,然後按一下「設定用戶端 (選用)」下方的「新增範圍」。 如果沒有,請點選「下一步」。
- 在測試操作說明下方,輸入
test
(或任何其他字串) 做為預留位置。(只有在實際提交要發布的動作時,才需要在這個欄位中填寫測試帳戶)。 - 點按「儲存」。
現在,您可以繼續閱讀下一節,開始在 iOS 或 Android 應用程式中實作 App Flip。
在原生應用程式中實作應用程式翻轉
如要實作應用程式 Flip,您需要修改應用程式中的使用者授權碼,以接受來自 Google 的深層連結。
在裝置上測試應用程式翻轉
您已經在主控台和應用程式中建立動作並設定應用程式翻轉,現在可以在行動裝置上測試應用程式翻轉。您也可以使用 Google 助理應用程式 測試應用程式 Flip。
如要透過 Google 助理應用程式測試應用程式 Flip,請按照下列步驟操作:
- 前往動作控制台並選取專案。
- 按一下頂端導覽列中的「測試」。
- 透過 Google 助理應用程式觸發帳戶連結流程:
- 開啟 Google 助理應用程式。
- 按一下「設定」。
- 在「Google 助理」分頁中,按一下「居家控制系統」。
- 按一下「新增」(+)。
- 從供應商清單中選取您的動作。這份清單中的前置字串為「[test]」。當您從清單中選取 [test] 動作時,系統應會開啟您的應用程式。
- 確認應用程式已啟動,並開始測試授權流程。