Error getting access token for service account: 400 Bad Request POST https://oauth2.googleapis.com/token {“error”:”invalid_grant”,”error_description”:”Invalid grant: account not found”}


Applications needs to pass the service account credentials in the Google Cloud API calls. This error occurs when the service account JSON file that is used to build the credential is not valid.

IoT Cloud Tester  application provides an easy interface to test this error. Google Cloud Platform.

How to fix -  Error getting access token for service account

  • Verify  the service account credential that is passed to the Google API is valid. This can be checked in the Google Cloud Console.

In the below example, an invalid service account file is passed to trigger this error condition.

Error message is also shown in the IoT Cloud Tester console window.

Error getting access token for service account: 400 Bad Request

POST https://oauth2.googleapis.com/token

{"error":"invalid_grant","error_description":"Invalid grant: account not found"}