Skip to content

Commit 02f444a

Browse files
committed
Update jobs sample
Update googleapis, use current auth. Refs: #878
1 parent a7a543b commit 02f444a

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

jobs/cjd_sample/package.json

+2-6
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,11 @@
1717
"test": "repo-tools test run --cmd ava -- -T 20s --verbose system-test/*.test.js"
1818
},
1919
"dependencies": {
20-
"googleapis": "27.0.0",
21-
"safe-buffer": "5.1.1",
22-
"uuid": "^3.2.1",
23-
"yargs": "11.0.0"
20+
"googleapis": "^35.0.0"
2421
},
2522
"devDependencies": {
2623
"@google-cloud/nodejs-repo-tools": "^3.0.0",
2724
"ava": "0.25.0",
28-
"proxyquire": "2.0.1",
29-
"semistandard": "^12.0.1"
25+
"semistandard": "^13.0.1"
3026
}
3127
}

jobs/cjd_sample/quickstart.js

+3-16
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,13 @@
1818
// [START quickstart]
1919

2020
// Imports the Google APIs client library
21-
const {google} = require('googleapis');
22-
23-
// Acquires credentials
24-
google.auth.getApplicationDefault((err, authClient) => {
25-
if (err) {
26-
console.error('Failed to acquire credentials');
27-
console.error(err);
28-
return;
29-
}
30-
31-
if (authClient.createScopedRequired && authClient.createScopedRequired()) {
32-
authClient = authClient.createScoped([
33-
'https://www.googleapis.com/auth/jobs'
34-
]);
35-
}
21+
const { google } = require('googleapis');
3622

23+
google.auth.getClient({ scopes: ['https://www.googleapis.com/auth/jobs'] }).then((auth) => {
3724
// Instantiates an authorized client
3825
const jobs = google.jobs({
3926
version: 'v2',
40-
auth: authClient
27+
auth
4128
});
4229

4330
// Lists companies

0 commit comments

Comments
 (0)