Reputation: 109
I want to use Google SpeechRecognition service as a fallback for SpeechRecognition API, the thing is that in the docs I only see a way to authenticate using the API key.
https://cloud.google.com/speech-to-text/docs/reference/rest/v1/speech/recognize
It seems to me like not a secure way and is easily abused, can I authenticate using a generated temp Bearer key?
Upvotes: 0
Views: 181
Reputation: 1820
You can use the following code sample to send a recognize REST request to the Speech-to-Text API.
Input json:
{
"config": {
"encoding":"FLAC",
"sampleRateHertz": 16000,
"languageCode": "en-US",
"enableWordTimeOffsets": false
},
"audio": {
"uri":"gs://cloud-samples-tests/speech/brooklyn.flac"
}
}
Curl command:
curl -s -H "Content-Type: application/json" \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
https://speech.googleapis.com/v1/speech:recognize \
-d @Input.json
Output:
For more information you can refer to this document.
Upvotes: 1