Created
May 23, 2021 14:50
-
-
Save YacheLee/ecdf8697701d27a501bee5f067e1d8b8 to your computer and use it in GitHub Desktop.
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 axios = require('axios'); | |
module.exports = async receivingServiceURL => { | |
const axiosInstance = axios.create({ | |
baseURL: 'http://metadata.google.internal/', | |
timeout: 10000, | |
headers: {'Metadata-Flavor': 'Google'} | |
}); | |
return axiosInstance.get(`computeMetadata/v1/instance/service-accounts/default/identity?audience=${receivingServiceURL}`).then(response => { | |
return response.data; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment