Closed a-mackay closed 1 week ago
Did you test this locally?
Yep, we built the plugin locally, and published our Android app successfully. It used my personal Google account set up via the gcloud
CLI, and impersonated our publisher Service Account.
Just to add, we contemplated some more tests around this but the only "logic" added resulted in a different instantiation of a GoogleCredentials, so it meant several levels of mocking to assert on a type and the logic is fairly simple so it didn't seem like the cost of the test added much value. The actual logic of using ADC and impersonation lives in the Google SDK anyway..
Good enough for me, thanks! I'll try to review this before the end of the weekend.
Can you give me edit access to the PR? I'd like to tweak some stuff
@SUPERCILEX all done
Thx. Can you give me PR access? https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork I'd like to clean up some nits
Don't think we can as this is forked into a non-personal repo... The link above seems to allude to it being in personal repos and I don't see the option on this PR either.. Might have to just suggest the clean ups and have us do them?
Ah, sounds good.
I'll do another pass tomorrow, but this what I was going to tweak for now.
Fixed those ones, let us know if there's anything else :)
Context
Usage of Service Account keys is generally discouraged, with service account impersonation being a recommended alternative.
Changes
Allow Application Default Credentials to be used, and support Service Account impersonation with it. This could be used as an alternative to the existing Service Account key authentication. Since it is an alternative method, it should not affect backwards compatibility.
One point of discussion is the default values used to build
ImpersonatedCredentials
inAndroidPublisher.kt
. We think these are suitable defaults - hardcoded values for the token lifetime was taken from GCP documentation and seems adequate given that tokens are autogenerated/refreshed by the underlying SDK as HTTP requests are constructed.