question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.

See original GitHub issue

In 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:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nnegreycommented, Aug 30, 2019

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_limits

Are you calling that only once via the command line and which page or file are you using?

0reactions
hlguocommented, Sep 5, 2019

yes,many thanks, the speech:recognize works now.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found