Created
February 23, 2020 19:06
-
-
Save cagataygurturk/ed602b8a915ccfdc0c0c5acd5d75460b to your computer and use it in GitHub Desktop.
Invoking Cloud Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const url = 'https://REGION-HOST_PROJECT_ID.cloudfunctions.net/FUNCTION_NAME'; | |
const targetAudience = url; | |
const {GoogleAuth} = require('google-auth-library'); | |
const auth = new GoogleAuth(); | |
async function request() { | |
const client = await auth.getIdTokenClient(targetAudience); | |
const res = await client.request({url}); | |
console.info(res.data); | |
} | |
request().catch(err => { | |
console.error(err.message); | |
process.exitCode = 1; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment