Skip to content

Commit 923c668

Browse files
authored
Merge pull request #848 from watson-developer-cloud/allow-access-token-for-stt
fix: make `access_token` an allowable query parameter for websockets
2 parents 900217b + a2ad09e commit 923c668

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/recognize-stream.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ const QUERY_PARAMS_ALLOWED = [
4646
'watson-token',
4747
'language_customization_id',
4848
'customization_id',
49-
'acoustic_customization_id'
49+
'acoustic_customization_id',
50+
'access_token'
5051
];
5152

5253
interface RecognizeStream extends Duplex {
@@ -97,6 +98,7 @@ class RecognizeStream extends Duplex {
9798
* @param {String} [options.model='en-US_BroadbandModel'] - voice model to use. Microphone streaming only supports broadband models.
9899
* @param {String} [options.url='wss://stream.watsonplatform.net/speech-to-text/api'] base URL for service
99100
* @param {String} [options.token] - Auth token
101+
* @param {String} [options.access_token] - IAM auth token
100102
* @param {Object} [options.headers] - Only works in Node.js, not in browsers. Allows for custom headers to be set, including an Authorization header (preventing the need for auth tokens)
101103
* @param {String} [options.content-type='audio/wav'] - content type of audio; can be automatically determined from file header in most cases. only wav, flac, ogg/opus, and webm are supported
102104
* @param {Boolean} [options.interim_results=false] - Send back non-final previews of each "sentence" as it is being processed. These results are ignored in text mode.

lib/synthesize-stream.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ const QUERY_PARAMS_ALLOWED = [
3333
'voice',
3434
'customization_id',
3535
'x-watson-learning-opt-out',
36-
'x-watson-metadata'
36+
'x-watson-metadata',
37+
'access_token'
3738
];
3839

3940
interface SynthesizeStream extends Readable {
@@ -75,6 +76,7 @@ class SynthesizeStream extends Readable {
7576
* @param {String} [options.customization_id] - The customization ID (GUID) of a custom voice model that is to be used for the synthesis.
7677
* @param {String} [options.url='wss://stream.watsonplatform.net/speech-to-text/api'] base URL for service
7778
* @param {String} [options.watson-token] - Auth token
79+
* @param {String} [options.access_token] - IAM auth token
7880
* @param {Object} [options.headers] - Only works in Node.js, not in browsers. Allows for custom headers to be set, including an Authorization header (preventing the need for auth tokens)
7981
* @param {Boolean} [options.x-watson-learning-opt-out=false] - set to true to opt-out of allowing Watson to use this request to improve it's services
8082
* @param {String} [options.x-watson-metadata] - Associates a customer ID with data that is passed over the connection.

0 commit comments

Comments
 (0)