title: ERROR: (gcloud.auth.activate-service-account) Failed to activate the given service account. Please ensure provided key file is valid
body: <p>I'm trying to follow this guide <a href="https://cloud.google.com/speech/docs/getting-started" rel="nofollow noreferrer">https://cloud.google.com/speech/docs/getting-started</a> to call GAE speech to text api through curl. But it doesn't seem to work.</p>
  
  <p>I've setup a project and enabled speech to text api. But then when I try to active the service account it fails. I've run diagnostics, tried different accounts, verified the json file (has email), tried gcloud beta init :-(</p>
  
  <p>bash-3.2$ gcloud auth activate-service-account account@project.iam.gserviceaccount.com --key-file=project.json
  ERROR: (gcloud.auth.activate-service-account) Failed to activate the given service account. Please ensure provided key file is valid.</p>
  
  <p>The next step though 'gcloud auth print-access-token' returns a token.</p>
  
  <p>But the final step (curl) returns this -</p>
  
  <p>{
    "error": {
      "code": 403,
      "message": "Google Cloud Speech API has not been used in project google.com:cloudsdktool before or it is disabled. Enable it by visiting <a href="https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=google.com:cloudsdktool" rel="nofollow noreferrer">https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=google.com:cloudsdktool</a> then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
      "status": "PERMISSION_DENIED",
      "details": [
        {
          "@type": "type.googleapis.com/google.rpc.Help",
          "links": [
            {
              "description": "Google developers console API activation",
              "url": "<a href="https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=google.com:cloudsdktool" rel="nofollow noreferrer">https://console.developers.google.com/apis/api/speech.googleapis.com/overview?project=google.com:cloudsdktool</a>"
            }
          ]
        }
      ]
    }
  }</p>
  
  <p>The problem seems to lie in the project(google.com:cloudsdktool instead of mine) used to authenticate the incoming request.</p>
  
  <p>I'm guessing the call to activate-service-account is causing this?</p>