iss*_*s42 2 oauth oauth-2.0 google-oauth actions-on-google google-home
尝试使用OAuth2授权代码流在Web模拟器中测试auth,https://developers.google.com/actions/tools/web-simulator
请参阅:https://developers.google.com/actions/tools/testing#testing_account_linking_with_google_home_web_simulator
并且:https: //developers.google.com/actions/develop/identity/oauth2-code-flow
如果您已将行动设置为要求授权服务授权,当您尝试访问您的行动时,助理会建议您需要关联您的帐户.在同一个响应中,模拟器提供了一个用于启动链接过程的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/"
}
]
}
Run Code Online (Sandbox Code Playgroud)
调用此URL(粘贴到浏览器中)将引导您完成OAuth2流程,假设所需的用户操作成功,Google将使用流程中提供的授权代码调用您的令牌端点.
但后来我得到了:
result_code=FAILURE&result_message=Account+linking+failed
Run Code Online (Sandbox Code Playgroud)
这一切似乎都在我的身边,但谷歌正在回归失败.
就我而言,我的令牌端点正在返回我的标准令牌响应对象,其中包括access_token,refresh_token,expires_in,session_state和另一个为此目的不需要但是我的令牌响应标准的令牌.
当我在Googles游乐场测试同样的响应时,它很好:https: //developers.google.com/oauthplayground/
但使用智能助理网址时则不是这样:https: //assistant.google.com/services/auth/handoffs/auth/start?provider = your-google-project-id_dev&sscopes = your-users =] .COM /
事实证明,助手不喜欢响应对象中多余的属性.
我还没有完全确定什么是允许的,但是到目前为止你可以:
{
"token_type": "Bearer",
"access_token: "xxx",
"refresh_token": "yyy",
"expires_in": "zzz"
}
Run Code Online (Sandbox Code Playgroud)
有了这些我现在得到:
result_code=SUCCESS
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1204 次 |
| 最近记录: |