I'd like to use Google's speech API.
https://cloud.google.com/speech/docs/getting-started?hl=ja
The quick start above has already failed.
Specifically,
Use curl to make a speech:syncrecognize request with the output access token and the
configured in Step 1
Passes the filename of the JSON request.
After you run , the expected voice recognition results do not return and an error returns.
The command is
curl-s-k-H "Content-Type: application/json" - H "Authorization: Bearer access token string "https://speech.googleapis.com/v1beta1/speech:[email protected]
The following error will be returned as a result of throwing
{
"error": {
"code": 401,
"message": "Request had invalid authentication credentials.Expected OAuth2 access token, login cookie or other valid authentication credential.See https://developers.google.com/identity/sign-in/web/devconsole-project.,
"status": "UNAUTHENTICATED"
}
}
I have created a service account key and got an access token, but what's wrong with it?
google-api
Expected OAuth2 access token, login cookie or other valid
authentication credential.
As such, did you set OAuth when creating the AccessKey?
The key is specified, but the OAuth credentials are not attached, so I think the error is displayed.
If you want to use it for the time being, create an unlimited key.
GCP console>API Manager>Create credentials>Create credentials>API key
After creating the key, try creating the key by pressing "Close" instead of pressing "Restrict Key"
Then
exportSPEECH_API_KEY=your key
curl-v-X POST-H "Content-Type: application/json" [email protected] "https://speech.googleapis.com/v1beta1/speech:syncrecognize?key=$ {SPEECH_API_KEY}"
(If you want to use Google cloud speech API with OAuth2 authentication instead of using Cloud Speech API for now, please let me know.)
Billing was not enabled for the project that issued the access key.No more errors when enabled.
--From the questioner's comment.
© 2024 OneMinuteCode. All rights reserved.