Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jeancarl
Copy link
Contributor

In SDK v.0.36 with Firefox 60.3.0esr (64-bit), using the new IAM API Key authentication for Text to Speech, the synthesize method filters out the access_token parameter.

var params = {
  text: "Hello",
  voice: "en-US_MichaelVoice",
  access_token: "<ACCESS_TOKEN>"
};

stream = WatsonSpeech.TextToSpeech.synthesize(params);

The requested URI resource doesn't include this access token and the watson-token parameter is undefined, returning a CORS error.

https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?voice=en-US_MichaelVoice&text=Hello&watson-token=**undefined**

There should also be a check that token parameter is defined, given it's either token or access_token.

module.exports = function synthesize(options) {
  if (!options || (!options.token && !options.access_token)) {
    throw new Error('Watson TextToSpeech: missing required parameter: options.token (CF) or options.access_token (RC)');
  }
  options['watson-token'] = options.token;
  delete options.token;
  var audio = options.element || new Audio();
Checklist
  • npm test passes (tip: npm run autofix can correct most style issues)

@CLAassistant
Copy link

CLAassistant commented Oct 31, 2018

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@germanattanasio germanattanasio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ‘ Thanks for the PR @jeancarl.

@dpopp07 is currently maintaining this repo so I would like him to look at this too.

Copy link
Contributor

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good πŸ‘

@germanattanasio germanattanasio merged commit 9cf2459 into watson-developer-cloud:master Nov 3, 2018
@watson-github-bot
Copy link

πŸŽ‰ This PR is included in version 0.35.2 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

5 participants