Re:Ask HN: Why does validating a user require 14000 files?
by yashg on Monday August 30, 2021 @05:33AM
(#28354059)
I am using this https://github.com/googleapis/google-api-php-client
Recommended by Google https://developers.google.com/identity/gsi/web/guides/verify...
Re:Ask HN: Why does validating a user require 14000 files?
by maverwa on Monday August 30, 2021 @05:50AM
(#28354153)
Oh wow, yeah. Looks like the culprit here is google/apiclient-services which provides a fat client for EVERY google API [1]
In classic google monorepo culture, thats one package for all the things. A great example on how not to structure your SDK.
So yeah, you are right. Thats a lot of code if you only use like 0.25% of it.
[1]: https://github.com/googleapis/google-api-php-client-services...
Re:Ask HN: Why does validating a user require 14000 files?
by yashg on Monday August 30, 2021 @06:25AM
(#28354296)
I liked what jQuery UI does. It provides a web based configurator to choose what components you want to use and then you download a custom file with only those components. Really useful Avoid wasteful loading of code you are never going to use.
As a comparison: looking at googles docs for "Google Identity Toolkit" (which is abandoned, thanks google!), the used google/identity-toolkit-php-client[1] composer package installs ~196 files with ~212k LoC PHP source, totaling at around 7MB. Still a lot for validating a token, but most of that is from the google/apiclient library, which seems to be a generic client for google APIs, and the google/identity-toolkit-php-client just adds 10 files and 729 lines of php code, which seems pretty reasonable.
[edit]: Looking at the more recent (and alive) google/auth[2] seems to add around 200 files with 12k LoC PHP, including the guzzlehttp client, some firebase client and some psr API stubs.
[1]: https://packagist.org/packages/google/identity-toolkit-php-c... [2]: https://packagist.org/packages/google/auth