简体   繁体   English

与谷歌助理的帐户关联未在 apprequest 中获取 accessToken

[英]Account Linking with google assistant not getting accessToken in apprequest

I have implemented account linking in google actions.我已经在 google 操作中实现了帐户链接。 I've chosen OAuth with Implicit linking type.我选择了带有隐式链接类型的 OAuth。 i got my account linked, but i'm not getting access-token in subsequent calls.我已关联帐户,但在后续调用中未获得访问令牌。 In the google documentation says :" After Google has obtained an access token for your service, Google will attach the token to subsequent calls to your Action as part of the AppRequest."在 google 文档中说:“在 Google 为您的服务获取访问令牌后,Google 会将令牌附加到后续对您的 Action 的调用,作为 AppRequest 的一部分。” The user information in the request should be in the following format:请求中的用户信息应采用以下格式:

{
user : {
  "idToken": string,
  "profile": {
    object (UserProfile)
  },
  "accessToken": string,
  "permissions": [
    enum (Permission)
  ],
  "locale": string,
  "lastSeen": string,
  "userStorage": string,
  "packageEntitlements": [
    {
      object (PackageEntitlement)
    }
  ],
  "userVerificationStatus": enum (UserVerificationStatus)
}
}

google apprequest format : https://developers.google.com/assistant/conversational/df-asdk/reference/webhook/rest/Shared.Types/AppRequest#User.FIELDS.access_token谷歌应用请求格式: https : //developers.google.com/assistant/conversational/df-asdk/reference/webhook/rest/Shared.Types/AppRequest#User.FIELDS.access_token

but i'm getting the request which is not containing any accessToken.但我收到的请求不包含任何 accessToken。

{
user:
   { locale: 'en-GB',
     params: {},
     accountLinkingStatus: 'LINKED',
     verificationStatus: 'VERIFIED',
     packageEntitlements: [],
     lastSeenTime: '2020-11-09T09:07:54Z' }
} 

google account linking docs : https://developers.google.com/assistant/identity/oauth2?oauth=implicit#flow谷歌帐户链接文档: https : //developers.google.com/assistant/identity/oauth2? oauth = implicit# flow

I found the access token in the header of the app request我在应用请求的标头中找到了访问令牌

authorization:'Bearer < accesstoken > '授权:'承载<访问令牌>'

headers:
   { host: '5cf1a2690f0c.ngrok.io',
     'user-agent': 'Google-ActionsOnGoogle/1.0',
     'content-length': '885',
     'accept-encoding': 'gzip,deflate,br',
     authorization: 'Bearer < accesstoken >',
     'content-type': 'application/json;charset=UTF-8',
     'google-actions-api-version': '3',
     'google-assistant-signature':
      '< google-assistant-signature >',
     'x-forwarded-for': '66.249.84.212',
     'x-forwarded-proto': 'https' }

according to the docs, it will be in the body section in the following format but I found it on the header.根据文档,它将以以下格式位于正文部分,但我在标题中找到了它。

{
user : {
  "idToken": string,
  "profile": {
    object (UserProfile)
  },
  "accessToken": string,
  "permissions": [
    enum (Permission)
  ],
  "locale": string,
  "lastSeen": string,
  "userStorage": string,
  "packageEntitlements": [
    {
      object (PackageEntitlement)
    }
  ],
  "userVerificationStatus": enum (UserVerificationStatus)
}
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM