microsoft / BotFramework-Services

Microsoft Bot Framework Services
Creative Commons Attribution 4.0 International
38 stars 11 forks source link

Unable to reconnect with a fresh token after old token expires #84

Closed deodad closed 5 years ago

deodad commented 5 years ago

Version 4.4.1 via NPM package

Unable to keep a conversation going after an ExpiredToken event followed by a call to directline.reconnect with a fresh token.When the connection status changes to ExpiredToken "unable to connect" appears but calling reconnect with the new token "unable to connect" stays.

A strange piece of this is seeing the connectionStatus change to 5. It appears this is being done (intentionally or otherwise) by a saga in webchat.

2019-05-23_14-12

To Reproduce

Steps to reproduce the behavior:

  1. Mount a Webchat component with a token and streamUrl
  2. Wait until the token is expired (or pass in an expired one)
  3. Attempt to send message
  4. Call directline.reconnect with a fresh token and streamUrl
  5. Attempt to send message

We'd expect to see Webchat move back into "connecting" and then "connected" state and be able to continue the conversation.

[Bug]

compulim commented 5 years ago

Transferring to botframework-services because this is related to token renewal.

deodad commented 5 years ago

howdy @compulim, are you sure? I have no problems renewing the token... it's just that the webchat component isn't updating back into a connected state when the connectionStatus$ goes from Expired back to Online.

EricDahlvang commented 5 years ago

@adaddeo How are you obtaining the 'fresh token and streamurl' before step 4?

deodad commented 5 years ago

@EricDahlvang you'll need to call the DirectLine API reconnect endpoint.

Since your token is expired at this point you'll need to use a secret and thus will want to do this call server side.

jameslew commented 5 years ago

I know this has been open for some time; however, did this ever get resolved @adaddeo ? Otherwise I will bring to the engineering team for feedback.

jameslew commented 5 years ago

Closing due to lack of activity; feel free to create a new issue to resume the investigation.