简体   繁体   English

令牌返回后,Google和帐户关联操作失败

[英]Actions on Google and Account linking failure after tokens returned

Trying to test auth in the Web Simulator using the OAuth2 Authorization Code Flow, https://developers.google.com/actions/tools/web-simulator 尝试使用OAuth2授权代码流https://developers.google.com/actions/tools/web-simulator在Web Simulator中测试身份验证

See: https://developers.google.com/actions/tools/testing#testing_account_linking_with_google_home_web_simulator 请参阅: https : //developers.google.com/actions/tools/testing#testing_account_linking_with_google_home_web_simulator

And: https://developers.google.com/actions/develop/identity/oauth2-code-flow 并且: https : //developers.google.com/actions/develop/identity/oauth2-code-flow

Provided you've setup your Action to require authorization against your authorization service, when you try to access your Action the Assistant advises you that you need to Link your account. 如果您已将操作设置为需要对授权服务进行授权,则当您尝试访问操作时,助手会建议您需要关联帐户。 In the same response the simulator provides a URL for initiating the linking process, see: 在同一响应中,模拟器提供了一个用于启动链接过程的URL,请参见:

"debugInfo": {
    "sharedDebugInfo": [
        {
            "name": "Account Linking Url",
            "debugInfo": "https://assistant.google.com/services/auth/handoffs/auth/start?provider=your-google-project-id_dev&scopes=your-scopes&return_url=https://www.google.com/"
        }
    ]
}

Calling this URL (paste into a browser) will take you through an OAuth2 flow, assuming the user actions required are successful Google will call your token endpoint with the authorization code provided during the flow. 调用此URL(将其粘贴到浏览器中)将引导您完成OAuth2流程,假设所需的用户操作成功完成,则Google会使用流程中提供的授权代码来调用令牌端点。

But then I was getting: 但是后来我得到了:

result_code=FAILURE&result_message=Account+linking+failed

It all appeared to be working from my side but Google was returning a FAILURE. 这一切似乎都在我这方面发挥作用,但Google传回了失败消息。

In my case, my token endpoint was returning my standard token response object, which included an access_token , a refresh_token , an expires_in , a session_state and another token that wasn't needed for this purpose but was standard to my token response. 在我的情况下,我的令牌端点正在返回我的标准令牌响应对象,该对象包括access_tokenrefresh_tokenexpires_insession_state和另一个不需要此令牌但对于我的令牌响应而言是标准的令牌。

And when I tested this same response on Googles playground it was fine: https://developers.google.com/oauthplayground/ 当我在Google的操场上测试相同的响应时,也很好: https//developers.google.com/oauthplayground/

But not so when using the Assistant URL: https://assistant.google.com/services/auth/handoffs/auth/start?provider=your-google-project-id_dev&scopes=your-scopes&return_url=https://www.google.com/ 使用助手网址时不是这样: https//assistant.google.com/services/auth/handoffs/auth/start?provider = your-google-project-id_dev&scopes = your-scopes&return_url = https://www.google .COM /

The reason it turns out is that the Assistant does not like superfluous properties in the response object. 事实证明,助手不喜欢响应对象中的多余属性。

I have yet to fully establish what is and isn't allowed but so far you can have: 我尚未完全确定允许和禁止的内容,但到目前为止您可以拥有:

{
    "token_type": "Bearer",
    "access_token: "xxx",
    "refresh_token": "yyy",
    "expires_in": "zzz"
}

With these I now get: 有了这些,我现在得到:

result_code=SUCCESS

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

相关问题 Google上的操作-帐户关联 - Actions on google - account linking 对谷歌帐户链接的操作返回错误 - Actions on google account linking returns error Google帐户关联操作-根据我们的帐户关联政策,Google帐户不能用作Auth端点网址 - Actions on Google Account Linking - Google accounts cannot be used as Auth endpoint urls per our Account Linking policy Google上的操作:帐户关联access_token问题 - Actions on Google: Account Linking access_token issue Google上的操作:在Alpha中进行测试时,帐户关联是否会持续/刷新? - Actions on Google: Does account linking persist/refresh while testing in Alpha? 在 Actions on Google 中与我自己的 OAuth 服务器关联的帐户缺少授权类型 - Account Linking with my own OAuth server in Actions on Google missing grant type Google Action,帐户关联:身份验证后插入代码 - Google Action, account linking: Insert a code after authentication Alexa帐户将错误与Google OAuth相关联 - Alexa account linking error with Google OAuth Google帐户可以在服务之间共享身份验证令牌吗? - Can Google Account auth tokens be shared between services? 如何判断 Google Adwords 和 Analytics API 中返回了哪些 OAuth 令牌 - How to tell which OAuth Tokens returned in Google Adwords and Analytics APIs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM