This release has it all. Bug fixes, new features, and improved test coverage! Here are some highlights.
Easy mode
This release includes a bunch of the features available in google-auto-auth. This makes it really easy to get started with service credentials. You can easily grab and use application default credentials:
const { auth } = require('google-auth-library');
async function main() {
const client = await auth.getClient();
const projectId = await auth.getDefaultProjectId();
const url = `https://www.googleapis.com/dns/v1/projects/${projectId}`;
const res = await client.request({ url });
console.log(res.data);
}
main().catch(console.error);Or easily use the client to authorize a request:
const { auth } = require('google-auth-library');
const axios = require('axios');
async function main() {
const client = await auth.getClient();
const projectId = await auth.getDefaultProjectId();
const url = `https://www.googleapis.com/dns/v1/projects/${projectId}`;
const opts = await auth.authorizeRequest();
const res = await axios.get(url, opts);
console.log(res.data);
}
main().catch(console.error);Commits in this release
64a1bd0 feat: add auto auth features (#281)
4d0c49d chore(package): update gcp-metadata to version 0.6.0 (#288)
60c5a1e chore: upgrade to TypeScript 2.7 (#289)
80c439a chore: upgrade all the things (#292)
5699b90 fix: cache GCE credentials (#286)
12feb2c test: improve coverage (#287)
7a951e0 fix: retry connections to gce metadata server (#284)
78d6813 fix: do not retry if a post with readable stream (#279)
3c9efe5 chore: use gcp-metadata (#278)