拥有 OAuth 2.0 实现后,你可以选择配置 基于 OAuth 的 App Flip,这可让你的 Android 用户更快地将其在你的 身份验证系统中的账号关联到他们的 Google 账号。以下部分 介绍了如何为您的 Cloud-to-cloud集成设计和实现 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
- You must have a Google authorization statement such as "Once linked, Google will have permission to control your devices."
- 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.
- 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.
- You must provide a way for users to go back, deny or cancel, if they choose not to link. Use the wording "Cancel" for the cancel action.
- 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:
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.
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 的 App Flip 进行设置
以下部分介绍了基于 OAuth 的 App Flip 的前提条件,以及如何在 Google Home Developer Console 中配置您的 App Flip 项目。
创建云到云集成并设置 OAuth 2.0 服务器
在配置 App Flip 之前,你需要执行以下操作:
- 设置 OAuth 2.0 服务器。如需详细了解如何设置 OAuth 服务器,请参阅实现 OAuth 2.0 服务器。
- 创建云到云集成。如需创建集成,请按照 创建云到云集成中的说明操作。
在 Developer Console 中配置 App Flip
以下部分介绍了如何在 Developer Console中配置 App Flip。
- 填写 OAuth Client information 下的所有字段。 (如果 App Flip 不受支持,则会使用常规 OAuth 作为后备选项。)
- 在 Use your app for account linking(optional) 下,选中 Enable for iOS 。
- 填写 Universal Link 字段。如需详细了解通用链接,请参阅允许应用和网站链接到你的内容。
- 如果想选择配置客户端,请添加范围,然后点击 Configure your client (optional) 下的添加范围 。
- 点击保存 。
现在,你可以继续下一部分,在 iOS 或 App Flip 应用中实现 。Android
在原生应用中实现 App Flip
如需实现 App Flip,你需要修改应用中的用户 101 授权代码,以接受来自 Google 的深层链接。
在设备上测试 App Flip
现在,你已在控制台和 应用中创建了一个云到云集成并配置了 App Flip,接下来可以在移动设备上测试 App Flip。你可以使用 Google Home 应用测试 App Flip。
如需通过 Google Home 应用测试 App Flip,请按以下步骤操作:
- 前往 Developer Console 并选择你的项目。
- 前往云到云 > 测试 。
- 在 Google Home 应用中触发账号关联流程:
- 打开 Google Home app (GHA)。
- 点击 + 按钮。
- 点击设置设备。
- 点击有已设置好的设备?
- 从提供商列表中选择你的云到云集成。它在列表中以“[test]”为 前缀。从列表中选择 [test] 集成后,就应该会打开你的应用。
- 验证你的应用是否已启动并开始测试授权流程。