0

I understand that this questions is discussed around 4-5 times but none of the solutions posted had helped me.

I created google developer account and enabled Google speech api, also registered project and have generated API_KEY. I am using JARVIS (on Google speech v2) to synthesize and recognize speech on my Java program.

The server always responds with 403 (forbidden) when querying the URL. I understand that it is saying I am not authorized. I even enabled billing to sort it out, but no luck.

Server returned HTTP response code: 403 for URL: https://www.google.com/speech-api/v2/recognize?output=json&lang=en-us&key=MY_KEY?client=chromium&output=json&lang=en-US&maxresults=4
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
    at com.darkprograms.speech.recognizer.Recognizer.rawRequest(Recognizer.java:455)
    at com.darkprograms.speech.recognizer.Recognizer.getRecognizedDataForFlac(Recognizer.java:280)
    at com.darkprograms.speech.main.ArtificialIntelligenceErrorDetection.speechToTextLogic(ArtificialIntelligenceErrorDetection.java:80)
    at com.darkprograms.speech.main.ArtificialIntelligenceErrorDetection.listenAlexa(ArtificialIntelligenceErrorDetection.java:43)
    at com.darkprograms.speech.main.VoiceServer$voiceHandler.handle(VoiceServer.java:60)

Please note, I am not using project ID generated by google. I think there is some missing link here. However, requesting your wise thoughts in this regards.

Thanks so much in advance.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Chirag Dhyani
  • 863
  • 11
  • 24

1 Answers1

0

Method: speech.recognize

Requires the following OAuth scope:

https://www.googleapis.com/auth/cloud-platform For more information, see the Auth Guide.

API key is used for accessing Public apis. You will need to create Oauth2 credentials and authenticate in order to access this api.

https://www.google.com/speech-api/v2/recognize?output=json&lang=en-us&access_token=accessTokenfromAuth&client=chromium&output=json&lang=en-US&maxresults=4

Google has a number of official samples that may be of help. Here

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449