简体   繁体   English

Google上的操作 - 如何撤销帐户关联?

[英]Actions on Google - How to revoke account linking?

Here is my situation : I develop a Google Assistant application with Dialogflow. 以下是我的情况:我使用Dialogflow开发了Google智能助理应用程序。 My service needs user to be connected to their account. 我的服务需要用户连接到他们的帐户。 So I implemented the OAuth 2.0 Authorization Code Flow as explained in the account linking Google guide . 因此,我按照链接Google指南帐户中的说明实施了OAuth 2.0授权代码流程。 Now my users can link my Assistant app to their account to vocally make action on it. 现在,我的用户可以将我的智能助理应用程序链接到他们的帐户,以便对其进行语音操作。 It's work great, no problems with that. 它的工作很棒,没有问题。

My question is here : I have to give the possibility to my users to revoke the link between Google Assistant and their account. 我的问题在于:我必须让用户撤消Google智能助理及其帐户之间的链接。 To do so I remove authorizations on my side and naturally returns a 401 response "invalid_grant" when I receive a request from the Assistant. 为此,我删除了我的授权,当我收到来自助理的请求时,自然会返回401响应“invalid_grant”。 My question is how can I notify Google that an access token has been revoked and that the user needs to relink the Assistant App to his account. 我的问题是如何通知Google已撤销访问令牌,并且用户需要将助理应用程序重新链接到他的帐户。 Usually the assistant notify the user by the following : 通常助手通过以下方式通知用户:

It looks like your MyAppName account is not linked yet 看起来您的MyAppName帐户尚未关联

Without that, Google keeps trying to send me requests until he does a refresh token and receive a 401 response. 没有它,谷歌一直试图向我发送请求,直到他做一个刷新令牌并收到401响应。 Is there an API or a way to directly revoke authorization on the Google Assistant side? 是否有API或方法直接撤销Google智能助理方面的授权?

Thanks for any answers ;-) 谢谢你的回答;-)

Sadly, Dialogflow do not seems to reset the token with a status 401 error response. 遗憾的是,Dialogflow似乎没有使用状态401错误响应重置令牌。

Google exposes an API for revoking access and refresh tokens. Google公开了一个用于撤销访问和刷新令牌的API。
For that, you have to send the following request 为此,您必须发送以下请求
https://accounts.google.com/o/oauth2/revoke?token={token} . https://accounts.google.com/o/oauth2/revoke?token={token}

See the different implementations 查看不同的实现

EDIT : It seems you only have to make Dialogflow reset its state. 编辑 :似乎你只需要让Dialogflow重置其状态。 Just proceed to make an edition on Dialogflow console seems to clean the access token. 只是继续在Dialogflow控制台上创建一个版本似乎清理访问令牌。

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

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