Google Service Accounts with Json File
Google has added the ability to download the Service account file as JSon. I am not exactly sure when they started offering it I first noticed it about six months ago. Originally when you created a service account you were given a P12 file. I have put together an example of how to use P12, Json and they key by itself. I don’t know how much longer Google will support the p12 file. I think its best to start switching to the Json file as soon as we can.
This code uses the Google .net client library, as an example I am using the new Google Analytics Reporting API V4.
The NuGet package can be found here
Make sure you create your project using .Net Framework 4.5.
What are Service accounts?
Service accounts are a way of accessing private data without having to authenticate. Service accounts are pre-authenticated by you the developer. I have a long post about service accounts you may want to read Google Developer console service account.
What is a P12 file?
PFX format is a binary format for storing the server certificate, any intermediate certificates, and the private key into a single encryptable file. PFX files are usually found with the extensions .pfx and .p12
This file when downloaded was password protected so you couldn’t actually see what was in it. The new Json files arn’t and you can actually open them.
Now that Google offers the option of downloading the Service account Key file as Json, and they state under P12 “for backward compatibility with code using P12 format” I think its a good idea we start using the JSon file when ever possible.
Note: I haven’t read anything any were that states that they will stop support for the P12 files. I just like to be prepared.