Throw an UnauthorizedError in an intent handler that requires an access token if the token is
invalid. This triggers an access token refresh request for the Action from the Assistant.
example
const app = conversation()
app.handle('My_Handler_Name_That_Requires_An_Access_Token', conv => {
// ...// given a function to check if an access token is still validconst valid = isTokenValid(conv.user.params.bearerToken)
if (!valid) {
thrownew UnauthorizedError()
}
})
Throw an UnauthorizedError in an intent handler that requires an access token if the token is invalid. This triggers an access token refresh request for the Action from the Assistant.
const app = conversation() app.handle('My_Handler_Name_That_Requires_An_Access_Token', conv => { // ... // given a function to check if an access token is still valid const valid = isTokenValid(conv.user.params.bearerToken) if (!valid) { throw new UnauthorizedError() } })