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 solve cross origin issue #64

Closed mohd7469 closed 6 years ago

mohd7469 commented 6 years ago

i am calling this API from client side and i have to call this from client side

https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?text=some_text&watson-token=some_token

infact when i tried to get token it still throw same error, i have to call this from browser for my application dont know what to do, stuck more then 9days never found something that could resolve this issue how do i get rid of this cross origin error which making this request infact every request unsuccessful from being able to call any suggestion please?

image

germanattanasio commented 6 years ago

Hi @awais786327, I think you are not sending the right token. We have a sample app that shows how to use this library once you get a valid token and it's working. See https://watson-speech.mybluemix.net/microphone-streaming.html

The code for that example is in the /examples folder. If you can't get a valid token using the /authorization service, you won't be able to call the services :(

mohd7469 commented 6 years ago

@germanattanasio actually i got the token by curl command and then use directly in browser but never works!

image

germanattanasio commented 6 years ago

Can you please provide a set of reproducible steps?

mohd7469 commented 6 years ago

@germanattanasio yeah sure, could there not be an easiest solution to get the token and SSML audio directly in AngularJS $http client side service like this ?

image

germanattanasio commented 6 years ago

@awais786327 I just tested this example https://github.com/watson-developer-cloud/speech-javascript-sdk/blob/master/examples/static/url-promise.html and was able to recognize the audio file.

What you are doing should work. Since this was opened in Feb 19 and we had a few releases since then. Can you update the library and try again?

mohd7469 commented 6 years ago

@germanattanasio thanks for your reply i did already with this AWS Polly Speech Synthesis

germanattanasio commented 6 years ago

I'm closing this since I couldn't reproduce it.