Closed
Description
Text to Speech with Custom Voice Example
text-to-speech-custom-voice.html
Error 401 Unauthorized when fetching https://stream-fra.watsonplatform.net/text-to-speech/api/v1/voices?watson-token=eyJ... (get-voices.js, line: 67)
http://localhost:3000/api/text-to-speech/token returned 200 OK and a token, which is used in the failing fetch.
Basic Text to Speech Example
http://localhost:3000/text-to-speech.html
works, thus my credentials in .env file should be okay.
Happens in Firefox 69 and Chrome 77, running on Windows 10 Pro 64 bit
Console log (Chrome):
text-to-speech-custom-voice.html:22
GET http://localhost:3000/scripts/fetch/dist/fetch.umd.js net::ERR_ABORTED 404 (Not Found)
get-voices.js:67
GET https://stream-fra.watsonplatform.net/text-to-speech/api/v1/voices?watson-token=eyJr... 401 (Unauthorized)
getVoices @ get-voices.js:67
(anonymous) @ text-to-speech-custom-voice.html:36
Promise.then (async)
(anonymous) @ text-to-speech-custom-voice.html:35
text-to-speech-custom-voice.html:1
Access to fetch at 'https://stream-fra.watsonplatform.net/text-to-speech/api/v1/voices?watson-token=eyJ...' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
TypeError: Failed to fetch
Promise.catch (async)
(anonymous) @ text-to-speech-custom-voice.html:50
Nothing on the node.js console.