Closed FISHMANPET closed 4 years ago
Hey @FISHMANPET - Thanks for revisiting and clarifying the intent! This makes a bit more sense now. I really like the value add here and with you involved in general, so I've shot you an invite to join the repo as a contributor. Let's sync up on this some time, looking forward to seeing the completed code!! 🙂
This is a continuation of the work I started in #255. You had some questions about the JSONServiceAccountKey, and at the time I was too busy to reply. Well suddenly for some reason I find myself with plenty of time on my hands 😄 and I'm coming back around to this.
The JSONServiceAccountKey that I implemented is different from the ClientSecretsPath that was already there. ClientSecretsPath is a JSON file backing an Oauth profile that authenticates as a user, whereas the JSONServiceAccountKey represents a service account.
Here's a sample client secret (which I know you know what it looks like but for completeness):
Compared to a JSON representing a service account:
So, anyway, quite different. It's created when you create a key for a service account, instead of creating a p12 you can get a JSON file (which actually contains the P12 plus all the other stuff about the account)![image](https://user-images.githubusercontent.com/7810151/77836709-755dd100-7126-11ea-844a-aba66e6a66c2.png)
When you took out the JSONServiceAccountKey stuff you actually left the parts in New-GoogleService that used it. I'm looking back at what I wrote as well, particularly for Get-PSGsuiteConfig, my intent was that if you specified JSONServiceAccountKey that it would attempt to read as much data as possible from it (AppEmail and ServiceAccountClientID) though looking at my code again I didn't actually succeed at that. Ultimately it may seem a little bit silly to import a JSON file into the PSGsuitSuite config file when P12 is perfectly functional, but as the screenshot above shows, JSON is the recommended key type for a service account, over the P12. For example, the code to create a credential with a JSON file vs P12 is much simpler.
While I'm at it, probably gonna figure out a way to import a full config without saving it as a JSON file.