actions-on-google / actions-on-google-nodejs

Node.js client library for Actions on Google
https://actions-on-google.github.io/actions-on-google-nodejs
Apache License 2.0
900 stars 197 forks source link

Prompt user to re-link their account before the token expires #403

Open nchatzi opened 3 years ago

nchatzi commented 3 years ago

Our agent uses OAuth account linking with Authentication code. We would like to suggest to the user to relink their account when the consent they've given is about to expire.

To achieve that, we first invalidate the consent on our auth server and then proceed to respond with a new SignIn(). However, the agent doesn't immediately recognise that the token is invalid, so the new SignIn() doesn't force the user to link their account again. The result is that the user will proceed on getting error responses when intents that need a linked account are invoked. This will occur until the agent realises that the token is not valid anymore (~30 minutes after the consent is invalidated on our auth server). 

Is there a way to force the agent to do the account linking process?

Note: Returning a 401 response (UnauthorisedError) is not really an option because we don't want the conversation to end. Instead we want the user to continue their conversation and for them to be able to immediately link their account again.