๐๐ผ๐ผ๐ด๐น๐ฒ ๐๐๐๐ต ๐ช๐ถ๐๐ต๐ผ๐๐ ๐๐ฒ๐ฎ๐๐ ๐ฃ๐ฎ๐ฐ๐ธ๐ฎ๐ด๐ฒ๐
The googleapis package is the standard for Node.js. It works. It is huge. It adds 450 dependencies to your project. You do not need this for a simple CI script.
I built a script to check URL index status. It uses 60 lines of code. It uses only Node.js built-ins like crypto, fetch, and URL. It adds zero packages to the repo.
Google service accounts use a JWT Bearer Grant. Here is the flow:
- Create a JWT with your email and private key.
- Send this JWT to the Google token endpoint.
- Get an access token.
- Use this token in your API headers.
Keep these tips in mind:
- Use the webmasters scope. The searchconsole scope does not work for URL Inspection.
- Use Base64url encoding. Strip padding and replace characters.
- Use the private key from Google Cloud Console. It works as is.
Use this raw method for small scripts or CI pipelines. Use a library if you:
- Call many different APIs.
- Need automatic token refresh.
- Need complex retry logic.
Clean code beats 450 dependencies for a narrow use case. Understanding the raw flow makes debugging easier.