Skip to content

Commit 9cf2459

Browse files
fix: Merge pull request #93 from jeancarl/master
fix: Synthesize method does not honor access_token from IAM API Key
2 parents e704f0e + 1408060 commit 9cf2459

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Diff for: dist/watson-speech.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -12124,7 +12124,7 @@ exports.getVoices = __webpack_require__(84);
1212412124
var pick = __webpack_require__(30);
1212512125
var qs = __webpack_require__(31);
1212612126

12127-
var QUERY_PARAMS_ALLOWED = ['voice', 'X-WDC-PL-OPT-OUT', 'X-Watson-Learning-Opt-Out', 'text', 'watson-token', 'accept', 'customization_id'];
12127+
var QUERY_PARAMS_ALLOWED = ['voice', 'X-WDC-PL-OPT-OUT', 'X-Watson-Learning-Opt-Out', 'text', 'watson-token', 'accept', 'customization_id', 'access_token'];
1212812128

1212912129
/**
1213012130
* @module watson-speech/text-to-speech/synthesize
@@ -12152,8 +12152,12 @@ module.exports = function synthesize(options) {
1215212152
if (!options || (!options.token && !options.access_token)) {
1215312153
throw new Error('Watson TextToSpeech: missing required parameter: options.token (CF) or options.access_token (RC)');
1215412154
}
12155-
options['watson-token'] = options.token;
12156-
delete options.token;
12155+
12156+
if(options.token) {
12157+
options['watson-token'] = options.token;
12158+
delete options.token;
12159+
}
12160+
1215712161
var audio = options.element || new Audio();
1215812162
audio.crossOrigin = 'anonymous';
1215912163
audio.src = 'https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?' + qs.stringify(pick(options, QUERY_PARAMS_ALLOWED));
@@ -12241,4 +12245,4 @@ module.exports = function getVoices(options) {
1224112245

1224212246
/***/ })
1224312247
/******/ ]);
12244-
});
12248+
});

0 commit comments

Comments
 (0)