Skip to content

Commit

Permalink
docs: add repo-metadata.json to generate docs (#730)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Jun 10, 2019
1 parent 50a15cd commit 04b73ba
Show file tree
Hide file tree
Showing 10 changed files with 229 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -12,3 +12,4 @@ samples/*.keys.json
package-lock.json
yarn.lock
dist/
__pycache__
10 changes: 10 additions & 0 deletions .repo-metadata.json
@@ -0,0 +1,10 @@
{
"name": "google-auth-library",
"name_pretty": "Google Auth Library",
"product_documentation": "https://cloud.google.com/docs/authentication/",
"client_documentation": "https://googleapis.dev/nodejs/google-auth-library/latest/",
"release_level": "ga",
"language": "nodejs",
"repo": "googleapis/google-auth-library-nodejs",
"distribution_name": "google-auth-library"
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -92,7 +92,7 @@
"fix": "gts fix && eslint --fix '**/*.js'",
"pretest": "npm run compile",
"license-check": "jsgl --local .",
"docs": "compodoc src/ && touch docs/.nojekyll",
"docs": "compodoc src/",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"system-test": "mocha build/system-test --timeout 60000",
"presystem-test": "npm run compile",
Expand Down
206 changes: 206 additions & 0 deletions samples/README.md
@@ -0,0 +1,206 @@
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `python -m synthtool`."
<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"/>

# [Google Auth Library: Node.js Samples](https://github.com/googleapis/google-auth-library-nodejs)

[![Open in Cloud Shell][shell_img]][shell_link]



## Table of Contents

* [Before you begin](#before-you-begin)
* [Samples](#samples)
* [Adc](#adc)
* [Compute](#compute)
* [Credentials](#credentials)
* [Headers](#headers)
* [Iap](#iap)
* [Jwt](#jwt)
* [Keepalive](#keepalive)
* [Keyfile](#keyfile)
* [Oauth2](#oauth2)
* [Verify Id Token](#verify-id-token)

## Before you begin

Before running the samples, make sure you've followed the steps outlined in
[Using the client library](https://github.com/googleapis/google-auth-library-nodejs#using-the-client-library).

## Samples



### Adc

View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/adc.js).

[![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)

__Usage:__


`node adc.js`


-----




### Compute

View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/compute.js).

[![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)

__Usage:__


`node compute.js`


-----




### Credentials

View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/credentials.js).

[![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)

__Usage:__


`node credentials.js`


-----




### Headers

View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/headers.js).

[![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)

__Usage:__


`node headers.js`


-----




### Iap

View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/iap.js).

[![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)

__Usage:__


`node iap.js`


-----




### Jwt

View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/jwt.js).

[![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)

__Usage:__


`node jwt.js`


-----




### Keepalive

View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/keepalive.js).

[![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)

__Usage:__


`node keepalive.js`


-----




### Keyfile

View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/keyfile.js).

[![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)

__Usage:__


`node keyfile.js`


-----




### Oauth2

View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/oauth2.js).

[![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)

__Usage:__


`node oauth2.js`


-----




### Verify Id Token

View the [source code](https://github.com/googleapis/google-auth-library-nodejs/blob/master/samples/verifyIdToken.js).

[![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)

__Usage:__


`node verifyIdToken.js`






[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[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
[product-docs]: https://cloud.google.com/docs/authentication/
12 changes: 3 additions & 9 deletions src/auth/googleauth.ts
Expand Up @@ -283,9 +283,7 @@ export class GoogleAuth {
try {
isGCE = await this._checkIsGCE();
} catch (e) {
e.message = `Unexpected error determining execution environment: ${
e.message
}`;
e.message = `Unexpected error determining execution environment: ${e.message}`;
throw e;
}

Expand Down Expand Up @@ -336,9 +334,7 @@ export class GoogleAuth {
options
);
} catch (e) {
e.message = `Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${
e.message
}`;
e.message = `Unable to read the credential file specified by the GOOGLE_APPLICATION_CREDENTIALS environment variable: ${e.message}`;
throw e;
}
}
Expand Down Expand Up @@ -413,9 +409,7 @@ export class GoogleAuth {
throw new Error();
}
} catch (err) {
err.message = `The file at ${filePath} does not exist, or it is not a file. ${
err.message
}`;
err.message = `The file at ${filePath} does not exist, or it is not a file. ${err.message}`;
throw err;
}

Expand Down
4 changes: 1 addition & 3 deletions src/auth/oauth2client.ts
Expand Up @@ -1121,9 +1121,7 @@ export class OAuth2Client extends AuthClient {
try {
envelope = JSON.parse(crypto.decodeBase64StringUtf8(segments[0]));
} catch (err) {
err.message = `Can't parse token envelope: ${segments[0]}': ${
err.message
}`;
err.message = `Can't parse token envelope: ${segments[0]}': ${err.message}`;
throw err;
}

Expand Down
6 changes: 1 addition & 5 deletions src/options.ts
Expand Up @@ -27,11 +27,7 @@ export function validate(options: any) {
];
for (const pair of vpairs) {
if (options[pair.invalid]) {
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.`;
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.`;
throw new Error(e);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/transporters.ts
Expand Up @@ -66,9 +66,9 @@ export class DefaultTransporter {
if (!uaValue) {
opts.headers['User-Agent'] = DefaultTransporter.USER_AGENT;
} else if (!uaValue.includes(`${PRODUCT_NAME}/`)) {
opts.headers['User-Agent'] = `${uaValue} ${
DefaultTransporter.USER_AGENT
}`;
opts.headers[
'User-Agent'
] = `${uaValue} ${DefaultTransporter.USER_AGENT}`;
}
}
return opts;
Expand Down
4 changes: 2 additions & 2 deletions synth.metadata
@@ -1,11 +1,11 @@
{
"updateTime": "2019-05-17T19:40:38.910539Z",
"updateTime": "2019-06-10T15:46:55.760733Z",
"sources": [
{
"template": {
"name": "node_library",
"origin": "synthtool.gcp",
"version": "2019.4.10"
"version": "2019.5.2"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion synth.py
Expand Up @@ -4,4 +4,4 @@
logging.basicConfig(level=logging.DEBUG)
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library()
s.copy(templates)
s.copy(templates, excludes=["README.md"])

0 comments on commit 04b73ba

Please sign in to comment.