Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.
See original GitHub issueIn which file did you encounter the issue?
Did you change the file? If so, how?
Describe the issue
I call the api as below:
curl -s -H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
https://speech.googleapis.com/v1p1beta1/speech:recognize \
--data '{
"config": {
"encoding":"LINEAR16",
"languageCode": "en-US",
"alternativeLanguageCodes": ["fr-FR", "de-DE"],
"model": "command_and_search"
},
"audio": {
"uri":"gs://cloud-samples-tests/speech/commercial_mono.wav"
}
}' > multi-language.txt
but I got the message as below:
{
"error": {
"code": 429,
"message": "Quota exceeded for quota metric 'speech.googleapis.com/default_requests' and limit 'DefaultRequestsPerMinutePerProject' of service 'speech.googleapis.com' for consumer 'project_number:764086051850'.",
"status": "RESOURCE_EXHAUSTED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developer console API key",
"url": "https://console.developers.google.com/project/764086051850/apiui/credential"
}
]
}
]
}
}
what’s wrong?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Request had invalid authentication credentials. Expected ...
It could be that The Application Default Credentials are not available. Try to login by running gcloud auth application-default login.
Read more >Request had invalid credentials. Expected OAuth 2 access ...
Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.
Read more >Why this Expected OAuth 2 access token happen
Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.
Read more >More posts you may like - Reddit
Error: 16 UNAUTHENTICATED : Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid ...
Read more >Frequently asked questions and troubleshooting | Cloud Asset ...
"message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, it looks like you have possibly 2 different error messages?
From your title it seems to be an IAM issue with auth. Worth making sure you completed all the steps on this page: https://cloud.google.com/speech-to-text/docs/quickstart-protocol
For the 2nd error in the body of your issue, a
RESOURCE_EXHAUSTED
/ Quota exceeded error is potentially from calling the API too much and exceeding the quota, but that would have to mean you are sending more than 900 requests in a minute as described here: https://cloud.google.com/speech-to-text/quotas#request_limitsAre you calling that only once via the command line and which page or file are you using?
yes,many thanks, the speech:recognize works now.