Skip to content

Instantly share code, notes, and snippets.

@nov05
Last active June 9, 2026 21:10
Show Gist options
  • Select an option

  • Save nov05/58523f8651a52f3a0cafa52d65e41476 to your computer and use it in GitHub Desktop.

Select an option

Save nov05/58523f8651a52f3a0cafa52d65e41476 to your computer and use it in GitHub Desktop.

🟒 Google Skills Arcade, GSP222

https://www.skills.google/games/7223/labs/44689

🟒⚠️ Issue solved.

πŸ‘‰  Scope the results returned from the API to just a single language code.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1120    0  1120    0     0  11101      0 --:--:-- --:--:-- --:--:-- 11200
{
  "error": {
    "code": 403,
    "message": "Your application is authenticating by using local Application Default Credentials. The texttospeech.googleapis.com API requires a quota project, which is not set by default. To learn how to set your quota project, see https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds .",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "SERVICE_DISABLED",
        "domain": "googleapis.com",
        "metadata": {
          "consumer": "projects/618104708054",
          "service": "texttospeech.googleapis.com"
        }
      },
      {
        "@type": "type.googleapis.com/google.rpc.LocalizedMessage",
        "locale": "en-US",
        "message": "Your application is authenticating by using local Application Default Credentials. The texttospeech.googleapis.com API requires a quota project, which is not set by default. To learn how to set your quota project, see https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds ."
      }
    ]
  }
}
@nov05

nov05 commented Jun 9, 2026

Copy link
Copy Markdown
Author

🟒⚠️ Issue solved. The key is to activate the service account and then gcloud config set account $SA.

βœ… Working code:

export SA="tts-qwiklab@$PROJECT_ID.iam.gserviceaccount.com"
gcloud iam service-accounts describe "$SA" >/dev/null 2>&1 || \
gcloud iam service-accounts create tts-qwiklab
until gcloud iam service-accounts describe "$SA" >/dev/null 2>&1
do sleep 5; done

## Authenticating by using local Application Default Credentials
gcloud iam service-accounts keys create tts-qwiklab.json \
    --iam-account "$SA"
echo -e "\nπŸ‘‰  Check the key file tts-qwiklab.json\n"
cat tts-qwiklab.json
echo

export GOOGLE_APPLICATION_CREDENTIALS=tts-qwiklab.json

cat << 'EOF'

========================================================
Task 4: Get a list of available voices
========================================================

EOF

gcloud auth activate-service-account --key-file=tts-qwiklab.json
gcloud config set account $SA
export TOKEN=$(gcloud auth print-access-token)

Issue:

gcloud auth activate-service-account "$SA" \
    --key-file=tts-qwiklab.json
========================================================
Task 4: Get a list of available voices
========================================================

ERROR: (gcloud.auth.activate-service-account) There was a problem refreshing auth tokens for account tts-qwiklab@qwiklabs-gcp-02-c0b860e10501.iam.gserviceaccount.com: ('invalid_grant: Invalid JWT Signature.', {'error': 'invalid_grant', 'error_description': 'Invalid JWT Signature.'})
Please run:

  $ gcloud auth activate-service-account --key-file=SERVICE_ACCOUNT_FILE_PATH

Or:

  $ gcloud auth login --cred-file=SERVICE_ACCOUNT_FILE_PATH

to obtain new credentials.

If you have already logged in with a different account, run:

  $ gcloud config set account ACCOUNT

to select an already authenticated account to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment