googleapis / google-auth-library-java

Open source Auth client library for Java
https://developers.google.com/identity
BSD 3-Clause "New" or "Revised" License
405 stars 218 forks source link

Google Play Publisher with Proxy Authentication #1412

Open Vacxe opened 1 month ago

Vacxe commented 1 month ago

Hi folks, I have strange behaviour with proxy and Google Play Publisher API. I created CLI wrapper for for official Google Play Java Library

It working flawless, however have some inconsistent behaviour with Proxy and Authentication.

I deployed Proxy on my Sever (Synology Proxy) with Authentication Username/Password and it working as expected, However on my work project I have :

com.google.auth.oauth2.GoogleAuthException: Error getting access token for service account: PKIX path building failed: sun.secutity.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target, iss:...

I followed guide from this repo https://github.com/googleapis/google-auth-library-java?tab=readme-ov-file#configuring-a-proxy and implemented similar proxy support https://github.com/Vacxe/google-play-cli-kt/blob/master/src/main/kotlin/com/github/vacxe/googleplaycli/TransportFactory.kt#L45-L68


I installed Charles Proxy on my machine and with Proxy configuration what you providede only "androidpublisher" calls going trought proxy, but I can't see oauth2.googleapis.com requests

If I adding

System.setProperty("proxyEnabed", "true")
System.setProperty("proxyHost", "127.0.0.1")
System.setProperty("proxyPort", "8888")

then oauth2 api calls appearing in Charles


Our corporate proxy required authentication for any calls

System.setProperty("proxyUser", "myuser")
System.setProperty("proxyPassword, "mypass")

Does't helps with authentication.


Can you help with https://github.com/Vacxe/google-play-cli-kt/blob/master/src/main/kotlin/com/github/vacxe/googleplaycli/PlayStoreApi.kt#L39

How to create AndroidPublisher with Proxy and Authentication, which will be delegated to OAuth as well