-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
79 lines (79 loc) · 6.11 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
"_args": [
[
{
"raw": "gtoken@https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz",
"scope": null,
"escapedName": "gtoken",
"name": "gtoken",
"rawSpec": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz",
"spec": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz",
"type": "remote"
},
"/Users/jennyphan/AngularToolingSamples/Angular4/aboutMe-app/functions/node_modules/firebase-admin"
]
],
"_from": "gtoken@https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz",
"_id": "gtoken@1.2.3",
"_inCache": true,
"_location": "/firebase-admin/gtoken",
"_phantomChildren": {},
"_requested": {
"raw": "gtoken@https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz",
"scope": null,
"escapedName": "gtoken",
"name": "gtoken",
"rawSpec": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz",
"spec": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz",
"type": "remote"
},
"_requiredBy": [
"/firebase-admin",
"/firebase-admin/google-auth-library"
],
"_resolved": "https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz",
"_shasum": "5509571b8afd4322e124cf66cf68115284c476d8",
"_shrinkwrap": null,
"_spec": "gtoken@https://registry.npmjs.org/gtoken/-/gtoken-1.2.3.tgz",
"_where": "/Users/jennyphan/AngularToolingSamples/Angular4/aboutMe-app/functions/node_modules/firebase-admin",
"author": {
"name": "Ryan Seys"
},
"bugs": {
"url": "https://github.com/google/node-gtoken/issues"
},
"dependencies": {
"google-p12-pem": "^0.1.0",
"jws": "^3.0.0",
"mime": "^1.4.1",
"request": "^2.72.0"
},
"description": "Node.js Google Authentication Service Account Tokens",
"devDependencies": {
"mocha": "^3.4.2"
},
"homepage": "https://github.com/google/node-gtoken#readme",
"keywords": [
"google",
"service",
"account",
"api",
"token",
"api",
"auth"
],
"license": "MIT",
"main": "./lib/index.js",
"name": "gtoken",
"optionalDependencies": {},
"readme": "# node-gtoken\n\nNode.js Google Authentication Service Account Tokens\n\n[![Build Status](https://travis-ci.org/google/node-gtoken.svg?branch=master)](https://travis-ci.org/google/node-gtoken)\n[![dependencies Status](https://david-dm.org/google/node-gtoken/status.svg)](https://david-dm.org/google/node-gtoken)\n[![Known Vulnerabilities](https://snyk.io/test/npm/google-p12-pem/badge.svg)](https://snyk.io/test/npm/google-p12-pem)\n\n## Installation\n\n``` sh\nnpm install gtoken\n```\n\n## Usage\n\n### Use with a `.pem` or `.p12` key file:\n\n``` js\nvar GoogleToken = require('gtoken');\nvar gtoken = GoogleToken({\n keyFile: 'path/to/key.pem', // or path to .p12 key file\n email: 'my_service_account_email@developer.gserviceaccount.com',\n scope: ['https://scope1', 'https://scope2'] // or space-delimited string of scopes\n});\n\ngtoken.getToken(function(err, token) {\n if (err) {\n console.log(err);\n return;\n }\n console.log(token);\n});\n```\n\n### Use with a service account `.json` key file:\n\n``` js\nvar GoogleToken = require('gtoken');\nvar gtoken = GoogleToken({\n keyFile: 'path/to/key.json',\n scope: ['https://scope1', 'https://scope2'] // or space-delimited string of scopes\n});\n\ngtoken.getToken(function(err, token) {\n if (err) {\n console.log(err);\n return;\n }\n console.log(token);\n});\n```\n\n### Pass the private key as a string directly:\n\n``` js\nvar key = '-----BEGIN RSA PRIVATE KEY-----\\nXXXXXXXXXXX...';\nvar GoogleToken = require('gtoken');\nvar gtoken = GoogleToken({\n email: 'my_service_account_email@developer.gserviceaccount.com',\n scope: ['https://scope1', 'https://scope2'], // or space-delimited string of scopes\n key: key\n});\n```\n\n## Options\n\n> Various options that can be set when creating initializing the `gtoken` object.\n\n- `options.email or options.iss`: The service account email address.\n- `options.scope`: An array of scope strings or space-delimited string of scopes.\n- `options.sub`: The email address of the user requesting delegated access.\n- `options.keyFile`: The filename of `.json` key, `.pem` key or `.p12` key.\n- `options.key`: The raw RSA private key value, in place of using `options.keyFile`.\n\n### .getToken(callback)\n\n> Returns the cached token or requests a new one and returns it.\n\n``` js\ngtoken.getToken(function(err, token) {\n console.log(err || token);\n // gtoken.token value is also set\n});\n```\n\n### Properties\n\n> Various properties set on the gtoken object after call to `.getToken()`.\n\n- `gtoken.token`: The access token.\n- `gtoken.expires_at`: The expiry date as milliseconds since 1970/01/01\n- `gtoken.key`: The raw key value.\n- `gtoken.raw_token`: Most recent raw token data received from Google.\n\n### .hasExpired()\n\n> Returns true if the token has expired, or token does not exist.\n\n``` js\ngtoken.getToken(function(err, token) {\n if(token) {\n gtoken.hasExpired(); // false\n }\n});\n```\n\n### .revokeToken()\n\n> Revoke the token if set.\n\n``` js\ngtoken.revokeToken(function(err) {\n if (err) {\n console.log(err);\n return;\n }\n console.log('Token revoked!');\n});\n```\n\n## Downloading your private `.p12` key from Google\n\n1. Open the [Google Developer Console][gdevconsole].\n2. Open your project and under \"APIs & auth\", click Credentials.\n3. Generate a new `.p12` key and download it into your project.\n\n## Converting your `.p12` key to a `.pem` key\n\nYou can just specify your `.p12` file (with `.p12` extension) as the `keyFile` and it will automatically be converted to a `.pem` on the fly, however this results in a slight performance hit. If you'd like to convert to a `.pem` for use later, use OpenSSL if you have it installed.\n\n``` sh\n$ openssl pkcs12 -in key.p12 -nodes -nocerts > key.pem\n```\n\nDon't forget, the passphrase when converting these files is the string `'notasecret'`\n\n## License\n\nMIT\n\n[gdevconsole]: https://console.developers.google.com\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/google/node-gtoken.git"
},
"scripts": {
"test": "mocha --timeout 5000"
},
"version": "1.2.3"
}