【问题标题】:redirect_uri_mismatch when OAuth2 account linking from Google Home Simulator从 Google Home Simulator 链接 OAuth2 帐户时的 redirect_uri_mismatch
【发布时间】:2017-01-05 17:35:50
【问题描述】:

我正在为“Actions on Google”与 API.AI 的集成开发帐户链接集成,以便与 Google Home 一起使用。当我在模拟器中测试这个代理时 (https://developers.google.com/actions/tools/web-simulator)

正如所料,这是我的回应:

{
    "response": "It looks like your conference manager account is not linked yet. You can link conference manager to your Google Account from the Google Home app.",
    "audioResponse": "//NExAARC..."content_copy,
    "debugInfo": {
        "sharedDebugInfo": [
            {
                "name": "Account Linking Url",
                "debugInfo": "https://assistant.google.com/services/auth/handoffs/auth/start?provider={project-id}_dev&return_url=https://www.google.com/"
            }
        ]
    }
}

但是,当我关注

res.debugInfo.sharedDebugInfo[0].debugInfo

链接,我得到标准 redirect_uri_mismatch 错误页面,详细信息:

请求中的重定向 URI, https://oauth-redirect.googleusercontent.com/r/my-project-id, 与 OAuth 客户端授权的不匹配。访问 https://console.developers.google.com/apis/credentials/oauthclient/my-client-id?project=my-client-id 更新授权的重定向 URI。

当然不可能将 googleusercontent 域添加到 重定向,这不是我在我的 API.AI Actions on Google 集成。

在 API.AI 方面,我的 Auth Url 是标准的 Google 网址: https://accounts.google.com/o/oauth2/v2/auth

我的令牌 URL 是: https://myendpoint.com/google-home-token-endpoint 范围填写为calendar

在 google 开发者控制台上,我将令牌 URL 设置为与 API.AI 中的相同,项目 ID/客户端 ID 与请求中的引用相同。

这是一个已知问题吗?我可以尝试其他调试工作吗?

【问题讨论】:

  • 目前您只能将 OAuth 与您拥有的 API 的操作一起使用。
  • @LeonNicholls 我想我明白了……这意味着我们目前无法将用户的 Google 帐户关联到“Actions on Google”与 API.AI 集成?
  • 是的,没错。

标签: actions-on-google google-home api-ai


【解决方案1】:

我也很困惑,为什么您无法通过 Login with Google 为 Actions on Google 进行帐户链接。

但是,我已经使用 Login With Amazon 完成了这项工作,方法如下:

  1. 在 api.ai 中,选择集成 -> google 上的操作。
  2. 选择一个调用名称在google developers console 中创建一个项目
  3. 输入对应的google项目ID
  4. 选择您的欢迎意图
  5. 转到the amazon developers console under login with amazon
  6. 在允许的来源下,输入https://accounts.google.com/
  7. 在允许的返回 URL 下,输入 https://oauth-redirect.googleusercontent.com/r/my-project-id(带有 您的谷歌项目 ID 如上所述)
  8. 返回 Actions on Google 弹出窗口,输入在亚马逊开发者控制台中创建的客户端 ID 和客户端密码。
  9. 设置授权类型 = 隐式
  10. 设置授权 URL = https://www.amazon.com/ap/oa

  11. 设置范围 = 配置文件

  12. 授权和预览,然后按照问题中的说明继续,将 res.debugInfo.sharedDebugInfo[0].debugInfo 的链接粘贴到浏览器会话。它将成功链接到关联的亚马逊帐户。

问题是 - 为什么我可以使用 Amazon 作为身份提供者和 OAuth2 使用 Web 联合身份验证,而不是 Google 在设置与 Google 上的 Actions 的帐户链接时?

【讨论】:

    【解决方案2】:

    查看 Leon 对我最初的问题的评论。

    目前无法使用您不拥有的 API 的 Actions 进行帐户链接。

    【讨论】:

      猜你喜欢
      • 2014-06-12
      • 2021-06-22
      • 2014-07-01
      • 2016-04-04
      • 1970-01-01
      • 2012-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多