Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const _setAuthCredential = async () => {
const res = await auth.getApplicationDefault();
let client = res.credential;
if (client.hasScopes && !client.hasScopes()) {
client = client.createScoped([
"https://www.googleapis.com/auth/cloud-billing",
"https://www.googleapis.com/auth/cloud-platform",
]);
}
// Set credential globally for all requests
google.options({
auth: client,
});
};