firebase - Google +帐户与Firebase关联时的操作

标签 firebase firebase-authentication actions-on-google

我正在使用外部API开发Google Home应用程序。我需要当前用户登录并与外部API链接(外部API提供的访问/刷新 token )。

我的方法:

  • 设置Firebase应用程序
  • Google主页应用程序位于functions文件夹中。
  • 我将建立一个页面,用户将首先使用firebase.auth()使用其Google帐户登录,然后使用其外部API帐户(使用外部API Oauth)登录。
  • 然后,我将在firebase数据库中创建一个条目,以为每个用户存储外部API提供的访问/刷新 token 。

  • 这是我有些困惑和困惑的地方。我已经成功设置了登录页面(Google登录,然后是外部API登录),并将其存储在Firebase数据库中(/users/{google_uid})。

    现在它已经存在于数据库中,如何在Google Home应用中设置身份验证?

    谢谢!

    最佳答案

    首先,您需要使用console.developers.google.com创建一个项目,并在您的项目中激活 Google Actions API 。然后,您应该按照以下步骤操作:

  • 将您API中的以下重定向URI列入白名单:
    https://oauth-redirect.googleusercontent.com/r/
  • 在您的API.AI项目中,转到Integrations并启用Actions on
    Google卡。
  • 在Google上“操作”的设置中,放置您的项目ID和
    选择登录所需的以表示欢迎意向及其他
    用户需要凭据的意图。
    enter image description here
  • 在下面,您将找到OAuth2字段,例如clientID,client
    secret ,授权URL和 token URL。使用OAuth2来实现
    您的API信息和授权应用程序。
    enter image description here

  • 授权后,您可以预览该应用程序,它将在您的Google Home设备中可用,并且在您首次调用时,它将在您的Google Home应用程序中提供一张卡片进行链接。如果您没有设备,则可以使用Web模拟器来测试操作。

    有关更多信息,请访问actions on google文档。

    关于firebase - Google +帐户与Firebase关联时的操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42916987/

    相关文章:

    android - 将 Google Home 响应转换到电视上的 Chromecast

    javascript - 如果用户之前使用过该操作,如何让 Dialogflow 代理向用户打招呼?

    actions-on-google - 如何告诉 Actions on Google 流式传输音频?

    android - 如何正确地从 Firebase 实时数据库中检索值?

    javascript - Firebase 中的 auth.currentUser.updateProfile 之后未触发 auth.onAuthStateChanged

    swift - 如何在创建帐户之前检查电子邮件是否已经存在(Swift)

    python - 使用 PyJWT 在 Python 中解码 Firebase JWT

    java - 如何在 Firestore 中获取特定集合?

    angular - CORS firebase 存储问题与 Angular 2 问题

    ios - AutoID 的 Swift Firebase 数据库数组