How do I access an API hosted behind the google endpoint (ESP) from a Node JS client?. The Node JS client is running in a google compute Engine. I am trying to use Google ID token as mentioned in the below URL, but couldn't find a sample code for the same.
Google has an official nodejs authentication library here:
https://github.com/google/google-auth-library-nodejs
If you're looking for code samples for how to authenticate to a remote service using a Google Web Token, there are several complete examples for different environments in that repository's README file, including an example for running in GCP:
https://github.com/google/google-auth-library-nodejs#json-web-tokens