Google 帐户链接操作未发送授权 Header 请求

Actions on Google Account Linking is not sending Authorization Header With Requests

我目前正在 Google 系统上设置一个操作,该系统也使用 API.AI。我完成了帐户 linking 设置,并且一切正常。在模拟器中,一旦我 link 我就会使用 "success" 查询参数发送到 google.com,如 Google 的文档中所指定。

一旦帐户被 linked,并且我通过 Google 主页或模拟器向我的服务发出请求,Google 不会附加授权 header 在其对我的服务的请求中。我需要在 API.AI 端进行某种设置吗?令牌是否没有作为授权 header 传递,而是出于某种奇怪的原因在 body 中传递?

Ninja 编辑:我在 Google 设置的操作中使用 "Authorization Code" 的授权类型。

在此先感谢您的帮助!

Actions on Google 不是在 header 中发送它,而是通过您收到的 JSON 中的属性发送它。如果您正在查看 JSON 或通过 app.getUser().accessToken 如果您使用的是 Node.js 库,则可以在 user.accessToken 处获取值。

详情见https://developers.google.com/actions/reference/rest/Shared.Types/AppRequest#User and https://developers.google.com/actions/reference/nodejs/AssistantApp#askForSignIn

请注意 https://developers.google.com/actions/identity/oauth2-code-flow#handle_data_access_requests 的页面似乎暗示它会在 header 中(逻辑表明它也应该如此!),但这似乎是一组通用的说明,而不特定于操作。