Skip to content

Commit

Permalink
Update jobs sample
Browse files Browse the repository at this point in the history
Update googleapis, use current auth.

Refs: #878
  • Loading branch information
fhinkel committed Nov 12, 2018
1 parent a7a543b commit 02f444a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
8 changes: 2 additions & 6 deletions jobs/cjd_sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
19 changes: 3 additions & 16 deletions jobs/cjd_sample/quickstart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 02f444a

Please sign in to comment.