我们建议在创建 Actions 项目之前实现 OAuth 2.0 服务器。
创建项目
要创建 Actions on Google developer project, follow these steps.
- 点击 New project。
输入项目名称,然后点击创建项目。
创建项目后,点击 Smart Home。
点击 Start building。
在 Quick Setup 下方,点击 Name your Smart Home action。输入你的 Action 名称,然后点击 Save。这是 smart home Action that you can connect to from the Google Home app (GHA) . 的名称
点击左侧菜单中的 Actions。
在 Fulfillment 网址 字段中,输入会为智能家居 intent 提供执行方式的后端服务器的网址,然后点击 Save。
如需详细了解 fulfillment 的工作原理,请参阅 fulfillment 和身份验证。
点击上方菜单中的 Test。在模拟器页面中,点击开始测试以完成项目设置。
如需详细了解测试,请参阅测试和分享智能家居 Action。
您已成功创建 smart home Actions 项目并提供了执行方式网址。现在,您可以使用帐号关联向项目中添加身份验证功能。
在控制台中配置帐号关联
要在 Actions on Google Console , follow these steps. 中设置帐号关联,请执行以下操作:
- 选择你的智能家居 Action 项目。
点击开发标签页。然后,点击左侧导航栏中的帐号关联。
填写 OAuth Client information 下的所有字段。点击 Next。
点击保存。