Skip to content

Commit 04b73ba

Browse files
docs: add repo-metadata.json to generate docs (#730)
1 parent 50a15cd commit 04b73ba

File tree

10 files changed

+229
-24
lines changed

10 files changed

+229
-24
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ samples/*.keys.json
1212
package-lock.json
1313
yarn.lock
1414
dist/
15+
__pycache__

.repo-metadata.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "google-auth-library",
3+
"name_pretty": "Google Auth Library",
4+
"product_documentation": "https://cloud.google.com/docs/authentication/",
5+
"client_documentation": "https://googleapis.dev/nodejs/google-auth-library/latest/",
6+
"release_level": "ga",
7+
"language": "nodejs",
8+
"repo": "googleapis/google-auth-library-nodejs",
9+
"distribution_name": "google-auth-library"
10+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"fix": "gts fix && eslint --fix '**/*.js'",
9393
"pretest": "npm run compile",
9494
"license-check": "jsgl --local .",
95-
"docs": "compodoc src/ && touch docs/.nojekyll",
95+
"docs": "compodoc src/",
9696
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
9797
"system-test": "mocha build/system-test --timeout 60000",
9898
"presystem-test": "npm run compile",

samples/README.md

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
2+
[//]: # "To regenerate it, use `python -m synthtool`."
3+
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
4+
5+
# [Google Auth Library: Node.js Samples](https://github.com/googleapis/google-auth-library-nodejs)
6+
7+
[![Open in Cloud Shell][shell_img]][shell_link]
8+
9+
10+
11+
## Table of Contents
12+
13+
* [Before you begin](#before-you-begin)
14+
* [Samples](#samples)
15+
* [Adc](#adc)
16+
* [Compute](#compute)
17+
* [Credentials](#credentials)
18+
* [Headers](#headers)
19+
* [Iap](#iap)
20+
* [Jwt](#jwt)
21+
* [Keepalive](#keepalive)
22+
* [Keyfile](#keyfile)
23+
* [Oauth2](#oauth2)
24+
* [Verify Id Token](#verify-id-token)
25+
26+
## Before you begin
27+
28+
Before running the samples, make sure you've followed the steps outlined in
29+
[Using the client library](https://github.com/googleapis/google-auth-library-nodejs#using-the-client-library).
30+
31+
## Samples
32+
33+
34+
35+
### Adc
36+
37+
View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/adc.js).
38+
39+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-auth-library-nodejs&page=editor&open_in_editor=samples/adc.js,samples/README.md)
40+
41+
__Usage:__
42+
43+
44+
`node adc.js`
45+
46+
47+
-----
48+
49+
50+
51+
52+
### Compute
53+
54+
View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/compute.js).
55+
56+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-auth-library-nodejs&page=editor&open_in_editor=samples/compute.js,samples/README.md)
57+
58+
__Usage:__
59+
60+
61+
`node compute.js`
62+
63+
64+
-----
65+
66+
67+
68+
69+
### Credentials
70+
71+
View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/credentials.js).
72+
73+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-auth-library-nodejs&page=editor&open_in_editor=samples/credentials.js,samples/README.md)
74+
75+
__Usage:__
76+
77+
78+
`node credentials.js`
79+
80+
81+
-----
82+
83+
84+
85+
86+
### Headers
87+
88+
View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/headers.js).
89+
90+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-auth-library-nodejs&page=editor&open_in_editor=samples/headers.js,samples/README.md)
91+
92+
__Usage:__
93+
94+
95+
`node headers.js`
96+
97+
98+
-----
99+
100+
101+
102+
103+
### Iap
104+
105+
View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/iap.js).
106+
107+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-auth-library-nodejs&page=editor&open_in_editor=samples/iap.js,samples/README.md)
108+
109+
__Usage:__
110+
111+
112+
`node iap.js`
113+
114+
115+
-----
116+
117+
118+
119+
120+
### Jwt
121+
122+
View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/jwt.js).
123+
124+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-auth-library-nodejs&page=editor&open_in_editor=samples/jwt.js,samples/README.md)
125+
126+
__Usage:__
127+
128+
129+
`node jwt.js`
130+
131+
132+
-----
133+
134+
135+
136+
137+
### Keepalive
138+
139+
View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/keepalive.js).
140+
141+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-auth-library-nodejs&page=editor&open_in_editor=samples/keepalive.js,samples/README.md)
142+
143+
__Usage:__
144+
145+
146+
`node keepalive.js`
147+
148+
149+
-----
150+
151+
152+
153+
154+
### Keyfile
155+
156+
View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/keyfile.js).
157+
158+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-auth-library-nodejs&page=editor&open_in_editor=samples/keyfile.js,samples/README.md)
159+
160+
__Usage:__
161+
162+
163+
`node keyfile.js`
164+
165+
166+
-----
167+
168+
169+
170+
171+
### Oauth2
172+
173+
View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/oauth2.js).
174+
175+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-auth-library-nodejs&page=editor&open_in_editor=samples/oauth2.js,samples/README.md)
176+
177+
__Usage:__
178+
179+
180+
`node oauth2.js`
181+
182+
183+
-----
184+
185+
186+
187+
188+
### Verify Id Token
189+
190+
View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/verifyIdToken.js).
191+
192+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-auth-library-nodejs&page=editor&open_in_editor=samples/verifyIdToken.js,samples/README.md)
193+
194+
__Usage:__
195+
196+
197+
`node verifyIdToken.js`
198+
199+
200+
201+
202+
203+
204+
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
205+
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-auth-library-nodejs&page=editor&open_in_editor=samples/README.md
206+
[product-docs]: https://cloud.google.com/docs/authentication/

src/auth/googleauth.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,7 @@ export class GoogleAuth {
283283
try {
284284
isGCE = await this._checkIsGCE();
285285
} catch (e) {
286-
e.message = `Unexpected error determining execution environment: ${
287-
e.message
288-
}`;
286+
e.message = `Unexpected error determining execution environment: ${e.message}`;
289287
throw e;
290288
}
291289

@@ -336,9 +334,7 @@ export class GoogleAuth {
336334
options
337335
);
338336
} catch (e) {
339-
e.message = `Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${
340-
e.message
341-
}`;
337+
e.message = `Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${e.message}`;
342338
throw e;
343339
}
344340
}
@@ -413,9 +409,7 @@ export class GoogleAuth {
413409
throw new Error();
414410
}
415411
} catch (err) {
416-
err.message = `The file at ${filePath} does not exist, or it is not a file. ${
417-
err.message
418-
}`;
412+
err.message = `The file at ${filePath} does not exist, or it is not a file. ${err.message}`;
419413
throw err;
420414
}
421415

src/auth/oauth2client.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,9 +1121,7 @@ export class OAuth2Client extends AuthClient {
11211121
try {
11221122
envelope = JSON.parse(crypto.decodeBase64StringUtf8(segments[0]));
11231123
} catch (err) {
1124-
err.message = `Can't parse token envelope: ${segments[0]}': ${
1125-
err.message
1126-
}`;
1124+
err.message = `Can't parse token envelope: ${segments[0]}': ${err.message}`;
11271125
throw err;
11281126
}
11291127

src/options.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ export function validate(options: any) {
2727
];
2828
for (const pair of vpairs) {
2929
if (options[pair.invalid]) {
30-
const e = `'${
31-
pair.invalid
32-
}' is not a valid configuration option. Please use '${
33-
pair.expected
34-
}' instead. This library is using Axios for requests. Please see https://github.com/axios/axios to learn more about the valid request options.`;
30+
const e = `'${pair.invalid}' is not a valid configuration option. Please use '${pair.expected}' instead. This library is using Axios for requests. Please see https://github.com/axios/axios to learn more about the valid request options.`;
3531
throw new Error(e);
3632
}
3733
}

src/transporters.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ export class DefaultTransporter {
6666
if (!uaValue) {
6767
opts.headers['User-Agent'] = DefaultTransporter.USER_AGENT;
6868
} else if (!uaValue.includes(`${PRODUCT_NAME}/`)) {
69-
opts.headers['User-Agent'] = `${uaValue} ${
70-
DefaultTransporter.USER_AGENT
71-
}`;
69+
opts.headers[
70+
'User-Agent'
71+
] = `${uaValue} ${DefaultTransporter.USER_AGENT}`;
7272
}
7373
}
7474
return opts;

synth.metadata

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"updateTime": "2019-05-17T19:40:38.910539Z",
2+
"updateTime": "2019-06-10T15:46:55.760733Z",
33
"sources": [
44
{
55
"template": {
66
"name": "node_library",
77
"origin": "synthtool.gcp",
8-
"version": "2019.4.10"
8+
"version": "2019.5.2"
99
}
1010
}
1111
]

synth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
logging.basicConfig(level=logging.DEBUG)
55
common_templates = gcp.CommonTemplates()
66
templates = common_templates.node_library()
7-
s.copy(templates)
7+
s.copy(templates, excludes=["README.md"])

0 commit comments

Comments
 (0)