I am trying to implement a service in TypeScript that generates an ID token using a Google service account to authenticate requests to a Google Cloud service, such as an Identity-Aware Proxy (IAP)-protected resource. In Java, I use GoogleCredentials.fromStream() to load the service account credentials from a JSON file and create an IdTokenCredentials object to generate the ID token.
Here's what I want to achieve in TypeScript:
What is the equivalent way to implement this in TypeScript, using google-auth-library or any other recommended library? A TypeScript code sample would be helpful.
Key Java concepts I want to translate into TypeScript:
I have already referred to this link https://github.com/googleapis/google-auth-library-nodejs/tree/main?tab=readme-ov-file#oauth2