watson-developer-cloud / speech-javascript-sdk

Library for using the IBM Watson Speech to Text and Text to Speech services in web browsers.
https://watson-speech.mybluemix.net/
260 stars 133 forks source link

How to handle re-authentication #12

Closed bradennapier closed 7 years ago

bradennapier commented 8 years ago

So we will need to fetch a new token after a hour it would appear. What is the recommended method of discovering that a new token is needed from the server so the request can be made? It does say a hour but that current sessions are not affected so it may not even matter (I am returning a ttsToken when session starts)

nfriedly commented 8 years ago

Currently I'd say just do a setTimeout or setInterval to proactively refresh the token, although I'm still looking into what would be an ideal solution.

nfriedly commented 7 years ago

BTW, this is what the official demo app does now: https://github.com/watson-developer-cloud/speech-to-text-nodejs/blob/master/views/demo.jsx#L228 and it seems to be working pretty well. So I think that's the recommend solution for now.