Monday, August 7, 2017

Google Service Account Private Key in JSON File

To authenticate the Google Cloud API's we need a Private Key which will be generated by Google for each Service Account Individually . This Private Key can be generated in 2 formats .


  • JSON format
  • PKCS12 format

Sample JSON file with Private Key:


{
 "type": "service_account",
 
 "project_id": "XXXX:api-project-1234",
 
 "private_key_id": "xxxxxx4360517xxxxx",
 
 "private_key": "-----BEGIN PRIVATE KEY-----\+lzqL6szpFDr5M/ow8Fa8X\nKokb6SfT+liJJboTVosoR8C1l1EnYRg+/qwv0w4JPdmLS1sY53k2EFP0EcqVYOYr\nDZx6a+TIVFB
 Xkas2IbyLsN13CCBJ5r1lhpCeP+nrCdi2MddXjTyfAIhGb5/fhTfU\nNoAaodmBuwKBgQDYzKuHLB9S+tjHKca/0fS1DLvo2vxbicDwAlDPrGfDrMHNKZBd\nKDTRJdk8R3FRNHcDHEZI969WyXcNNycM2aNcWy
 jMlCM/15pGylzDZRmP7gM20VFG\nnoNV5Y0TARJYGP2652kVsA2LuiBaA2GPHORSXo4/RvR6B+hQYJdh3GkGUQKBgQCY\nitMHu0ZkbLfze8kEYtnhX20SO5OaNgVtOcVd5RnEkU6W8fjY0ugpINbg+m7ZQh09\
 nS7z8T8DBf0CO2R4izaFZ==\n-----END PRIVATE KEY-----\n",
 
 "client_email": "xxxxxxxxxxxxxx.iam.gserviceaccount.com",
 
 "client_id": "xxxxxx4360517xxxxx",
 
 "auth_uri": "https://accounts.google.com/o/oauth2/auth",
 
 "token_uri": "https://accounts.google.com/o/oauth2/token",
 
 "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
 
 "client_x509_cert_url": "https://www.googleapis.com/xxxxxxxiam.gserviceaccount.com"
}

The one which resides between BEGIN PRIVATE KEY and END PRIVATE KEY is called Private Key.

For more information please refer this link.

Hope this helps you....Enjoy!
  


No comments:

Post a Comment