diff --git a/jobs/cjd_sample/package.json b/jobs/cjd_sample/package.json index 196b7c244e..a35a1894b9 100644 --- a/jobs/cjd_sample/package.json +++ b/jobs/cjd_sample/package.json @@ -17,15 +17,11 @@ "test": "repo-tools test run --cmd ava -- -T 20s --verbose system-test/*.test.js" }, "dependencies": { - "googleapis": "27.0.0", - "safe-buffer": "5.1.1", - "uuid": "^3.2.1", - "yargs": "11.0.0" + "googleapis": "^35.0.0" }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "^3.0.0", "ava": "0.25.0", - "proxyquire": "2.0.1", - "semistandard": "^12.0.1" + "semistandard": "^13.0.1" } } diff --git a/jobs/cjd_sample/quickstart.js b/jobs/cjd_sample/quickstart.js index 8d9729a75e..acd28577ac 100755 --- a/jobs/cjd_sample/quickstart.js +++ b/jobs/cjd_sample/quickstart.js @@ -18,26 +18,13 @@ // [START quickstart] // Imports the Google APIs client library -const {google} = require('googleapis'); - -// Acquires credentials -google.auth.getApplicationDefault((err, authClient) => { - if (err) { - console.error('Failed to acquire credentials'); - console.error(err); - return; - } - - if (authClient.createScopedRequired && authClient.createScopedRequired()) { - authClient = authClient.createScoped([ - 'https://www.googleapis.com/auth/jobs' - ]); - } +const { google } = require('googleapis'); +google.auth.getClient({ scopes: ['https://www.googleapis.com/auth/jobs'] }).then((auth) => { // Instantiates an authorized client const jobs = google.jobs({ version: 'v2', - auth: authClient + auth }); // Lists companies