简体   繁体   中英

Dailogflow account unlinking using webhook

I have successfully linked the account in dialogflow. I can also validate the access token received in the request.

but in case of invalid access token I want to ask the user to again link their account by first unlinking the account from the webhook and then send the actions.intent.SIGN_IN .

I am able to do the unlinking from test simulator of Actions Console manually but is there any way to unlink the account from the webhook or is there any way to unlink the account programmatically?

The only way to do this from your webhook is to return a status_code of 401. Yep, you heard that right. The expected solution is to return an error.

I wouldn't believe it myself, if it didn't come straight from AoG support...

return a HTTP 401 Unauthorized error from your webhook, to any request to indicate to Google that a new access token must be acquired. Google then exits the app with the error message "app assistant isn't responding right now. Try again soon." When the user invokes your app again, he is required to account link.

So the expected solution is to for your action to respond as if your webhook is broken, expect the user to try again despite the "error", then they'll not have a token and will follow the unlinked flow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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