BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

Speech Service Token Duration Extension Issue

Open Amintasn opened this issue 6 years ago • 2 comments

Version

Webchat: V4.8.0 CDN: https://cdn.botframework.com/botframework-webchat/latest/webchat.js Botframework: V4

Describe the bug

I need to keep a Speech Service alive for a long period of time. Speech Service tokens last 10 minutes by default. Hence a service duration extension is required which requires a new token. I'm trying to adapt the following sample code available at https://github.com/microsoft/BotFramework-WebChat/blob/master/samples/03.speech/b.cognitive-speech-services-js/index.html However, it seems it doesn't requests a new token while keeping the bot flow. Could you please advise?

Thx,

Steps to reproduce

  1. Create an index.html by pasting the code from the sample code mentioned above.
  2. Reduce the expireAfter = now + 300000; to expireAfter = now + 2000; to speed up token expiration
  3. Add the command console.log(lastPromise); before the return lastPromise; entry in the createFetchSpeechServicesCredentials() function.
  4. See the lastPromise token generated on the Google browser console.
  5. Wait 2 seconds for the new token to be generated
  6. Check again the lastPromise token variable on the Google browser console.
  7. Issue: the token doesn't update.

Expected behavior

The Speech test token should update according to the interval stated at expireAfter = now + x; entry.

Amintasn avatar Jun 06 '20 18:06 Amintasn

Sorry. The token is actually changing. BTW, is the source code for https://webchat-mockbot.azurewebsites.net/speechservices/token available somewhere? That would be extremely useful!Thx in advance

Amintasn avatar Jun 07 '20 18:06 Amintasn

Thanks. I found a sample token generator code at https://github.com/compulim/BotFramework-MockBot/blob/master/src/index.ts#L134 and managed to adapt it to my application. So I will be closing the case. Cheers.

Amintasn avatar Jun 08 '20 23:06 Amintasn