I needed to add:

jobs:
   my_job:
   # Need to add these 3 lines to add "id-token" with the intended permissions.
   permissions:
     contents: 'read'
     id-token: 'write'

This is documented here: https://github.com/google-github-actions/auth#usage

Answer from Brian C. on Stack Overflow
🌐
GitHub
github.com › vmware-tanzu › velero › issues › 8523
push.yml: Upgrade from google-github-actions/setup-gcloud@v0 · Issue #8523 · vmware-tanzu/velero
December 18, 2024 - More fixes needed by upping from unsupported gcloud auth · Error: The v0 series of google-github-actions/setup-gcloud is no longer maintained. It will not receive updates, improvements, or security patches.
Author   kaovilai
🌐
GitHub
github.com › google-github-actions › auth
GitHub - google-github-actions/auth: A GitHub Action for authenticating to Google Cloud. · GitHub
A GitHub Action for authenticating to Google Cloud. - google-github-actions/auth
Starred by 1.3K users
Forked by 295 users
Languages   TypeScript 98.8% | JavaScript 1.2%
🌐
GitHub
github.com › firebase › firebase-js-sdk › issues › 8274
Workflows fail in forks · Issue #8274 · firebase/firebase-js-sdk
May 30, 2024 - Annotations 4 errors and 2 warnings Binary Size The v0 series of google-github-actions/auth is no longer maintained. It will not receive updates, improvements, or security patches.
Published   May 30, 2024
Author   jsoref
🌐
GitHub
github.com › google-github-actions › auth › tree › v0.3.1
GitHub - google-github-actions/auth at v0.3.1
jobs: job_id: # ... # Add "id-token" with the intended permissions. permissions: contents: 'read' id-token: 'write' steps: - id: 'auth' name: 'Authenticate to Google Cloud' uses: 'google-github-actions/auth@v0.3.0' with: token_format: 'access_token' workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider' service_account: 'my-service-account@my-project.iam.gserviceaccount.com' # Example of using the token: - name: 'Access secret' run: |- curl https://secretmanager.googleapis.com/v1/projects/my-project/secrets/my-secret/versions/1:access \ --header "Authorization: Bearer ${{ steps.auth.outputs.access_token }}"
Starred by 1.2K users
Forked by 272 users
Languages   TypeScript 98.8% | JavaScript 1.2% | TypeScript 98.8% | JavaScript 1.2%
🌐
GitHub
github.com › google-github-actions › auth › issues › 160
Inconsistent but persistent auth errors starting today · Issue #160 · google-github-actions/auth
April 5, 2022 - ##[debug]Evaluating condition for step: 'Login to Google Cloud' ##[debug]Evaluating: success() ##[debug]Evaluating success: ##[debug]=> true ##[debug]Result: true ##[debug]Starting: Login to Google Cloud ##[debug]Register post job cleanup for action: google-github-actions/auth@v0 ##[debug]Loading inputs ##[debug]Evaluating: secrets.WORKLOAD_ID_PROVIDER_STAGING ##[debug]Evaluating Index: ##[debug]..Evaluating secrets: ##[debug]..=> Object ##[debug]..Evaluating String: ##[debug]..=> 'WORKLOAD_ID_PROVIDER_STAGING' ##[debug]=> '***' ##[debug]Result: '***' ##[debug]Evaluating: secrets.SERVICE_ACCOU
Author   selfagency
🌐
GitHub
github.com › google-github-actions › auth › issues
Issues · google-github-actions/auth
A GitHub Action for authenticating to Google Cloud. - Issues · google-github-actions/auth
Author   google-github-actions
Find elsewhere
Top answer
1 of 1
4

As per the error seems to be you have given invalid json file of service account which is not parsed by the Git actions workflow. As per this official github :

  1. (Optional) Create a Google Cloud Service Account. If you already have a Service Account, take note of the email address and skip this step :
    # TODO: replace ${PROJECT_ID} with your value below.             
    gcloud iam service-accounts create "my-service-account" \
      --project "${PROJECT_ID}"
  1. Create a Service Account Key JSON for the Service Account.
# TODO: replace ${PROJECT_ID} with your value below.
gcloud iam service-accounts keys create "key.json" \
  --iam-account "my-service-account@${PROJECT_ID}.iam.gserviceaccount.com"
  1. Upload the contents of this file as a GitHub Actions Secret. Use the name of the GitHub Actios secret as the credentials_json value in the GitHub Actions YAML:
 uses: 'google-github-actions/auth@v2'
  with:
      credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' # Replace with the name of your GitHub Actions secret

Can you validate the above steps as per your yaml seems to be you need to give correct service account JSON file and also credentials json format need to be taken care.

---------- or else you can also achieve by using Workload Identity Federation through a Service Account by following this official github

Edit : Sinethemba Nontshintshi, achieved this by Changing the approach and used the Workload Identity Federation through a Service Account method to authenticate, by using this guide on how to set it up in GCP and in the YAML file it is passed as follows :

 - name: Authenticate Google Cloud             
   uses: google-github-actions/auth@v2             
   with: 
     service_account: 'your-service account'              
     workload_identity_provider: 'your-workload-identity-provider'
🌐
GitHub
github.com › google-github-actions › setup-gcloud › issues › 553
unable to use credential generated from google-github-actions/setup-gcloud@v0 · Issue #553 · google-github-actions/setup-gcloud
May 5, 2022 - 484668Z 'a98b8209a4266acd4ef41d5a638ce10c3c507d7b' 2022-05-04T21:46:22.8749776Z ##[group]Run google-github-actions/setup-gcloud@v0 2022-05-04T21:46:22.8750086Z with: 2022-05-04T21:46:22.8750314Z version: latest 2022-05-04T21:46:22.8750588Z export_default_credentials: false 2022-05-04T21:46:22.8750876Z cleanup_credentials: true 2022-05-04T21:46:22.8751121Z env: 2022-05-04T21:46:22.8751533Z REPOSITORY_NAME: *** 2022-05-04T21:46:22.8751977Z SERVICE_ACCOUNT: *** 2022-05-04T21:46:22.8752294Z PROJECT: *** 2022-05-04T21:46:22.8752571Z REGION: *** 2022-05-04T21:46:22.8752894Z PACKAGE_NAME: *** 2022-05
Author   luisarodriguees
🌐
GitHub
github.com › sethvargo › oidc-auth-google-cloud › releases
Releases · google-github-actions/auth
August 28, 2025 - A GitHub Action for authenticating to Google Cloud. - Releases · google-github-actions/auth
Author   google-github-actions
🌐
Google Cloud
cloud.google.com › blog › products › devops-sre › using-github-actions-with-google-cloud-deploy
Using GitHub Actions with Google Cloud Deploy | Google Cloud Blog
May 9, 2023 - First, we will use the checkout and auth actions to check out the repository and authenticate to Google Cloud.
🌐
GitHub
github.com › google-github-actions › auth › issues › 455
getAccessToken denied issue · Issue #455 · google-github-actions/auth
google-github-actions/auth failed with: failed to generate Google Cloud OAuth 2.0 Access Token for github-actions-service-account@PROJECT.iam.gserviceaccount.com: { "error": { "code": 403, "message": "Permission 'iam.serviceAccounts.getAccessToken' denied on resource (or it may not exist).", "status": "PERMISSION_DENIED", "details": [ { "@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "IAM_PERMISSION_DENIED", "domain": "iam.googleapis.com", "metadata": { "permission": "iam.serviceAccounts.getAccessToken" } } ] } }
🌐
GitHub
github.com › google-github-actions › auth › issues › 60
Invalid value for "audience" · Issue #60 · google-github-actions/auth
November 25, 2021 - - uses: 'google-github-actions/setup-gcloud@master' with: project_id: ${{ secrets.GCP_PROJECT }} - id: 'auth' name: 'Authenticate to GCP' uses: 'google-github-actions/auth@v0.4.0' with: create_credentials_file: true #token_format: access_token workload_identity_provider: ${{ secrets.GCP_OIDC_ID_PROVIDER }} service_account: ${{ secrets.GCP_OIDC_SA}} - id: 'gcloud' name: 'gcloud' run: |- gcloud auth login --brief --cred-file="${{ steps.auth.outputs.credentials_file_path }}" # Now you can run gcloud commands authenticated as the impersonated service account.
Author   PSchnurbus24
🌐
GitHub
github.com › google-github-actions › auth › blob › main › docs › EXAMPLES.md
auth/docs/EXAMPLES.md at main · google-github-actions/auth
A GitHub Action for authenticating to Google Cloud. - auth/docs/EXAMPLES.md at main · google-github-actions/auth
Author   google-github-actions
🌐
GitHub
github.com › nextflow-io › nextflow › issues › 6612
Authentication issues when using `google-github-actions/auth@v3` · Issue #6612 · nextflow-io/nextflow
November 25, 2025 - Bug report Hey, I'm experiencing issues with authentication when running nextflow workflows in GitHub Actions using the google-batch executor. Expected behavior and actual behavior The GitHub Actions workflow authenticates to my Google C...
Author   moritzvonstetten
🌐
GitHub
github.com › marketplace › actions › authenticate-to-google-cloud
Authenticate to Google Cloud · Actions · GitHub Marketplace · GitHub
Authenticate to Google Cloud from GitHub Actions via Workload Identity Federation or service account keys
🌐
GitHub
github.com › backstage › backstage › issues › 20251
🐛 Bug Report: GHE - github-actions auth issue · Issue #20251 · backstage/backstage
📜 Description This is in regards to the github-actions plugin defined here: https://github.com/backstage/backstage/tree/master/plugins/github-actions We've been having trouble with this plugin since v0.6.0 - prior to this version, we had...