Unexpected exception reading PKCS#8 data – Reading private key


Applications needs to pass the service account credentials in the Google Cloud API calls. This error occurs when the private key in the service account JSON file is corrupted.

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 private key in the service account JSON file in not corrupted. This can be checked in the Google Cloud Console.

In the below example, a service account JSON file with corrupted private key is passed to trigger this error condition.