Skip to content

Instantly share code, notes, and snippets.

@YacheLee
Created May 23, 2021 14:50
Show Gist options
  • Save YacheLee/ecdf8697701d27a501bee5f067e1d8b8 to your computer and use it in GitHub Desktop.
Save YacheLee/ecdf8697701d27a501bee5f067e1d8b8 to your computer and use it in GitHub Desktop.
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