{"_id":"@botmatic/js-jwt","_rev":"2-1a5ebabc48a3b1754063a3f8dc9ef658","name":"@botmatic/js-jwt","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@botmatic/js-jwt","version":"1.0.0","description":"A simple JWT module to authenticate an integration to external services","main":"src/index.js","scripts":{"test":"jasmine"},"author":"","license":"ISC","dependencies":{"request":"^2.83.0"},"devDependencies":{"chai":"^4.1.2","nock":"^9.1.6"},"gitHead":"9f8e397238aead3ef51a125d777d6516a0caa003","_id":"@botmatic/js-jwt@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.3.0","_npmUser":{"name":"botmatic","email":"kevin+botmatic-npm@botmatic.ai"},"dist":{"integrity":"sha512-i7Wc7Vrhfy5iTw56GYU9eql/NxfhHOwzXjIQ+ikp5qoWJ+jHkW74xZjZHNQp8TVMYdhek9e6qDOsRDoTmzDFvQ==","shasum":"5c0d0093038b74b1b5da9e55eaef5efa45a79e1c","tarball":"https://registry.npmjs.org/@botmatic/js-jwt/-/js-jwt-1.0.0.tgz","fileCount":7,"unpackedSize":7412,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA2gkKM7tiBkYNjtaqURnxRlqFXrh1QpOsbICj183O1yAiB3UL/j+TUxfcYgFaRB29bMooIoV4p7NWH4bFJA2a/Qfg=="}]},"maintainers":[{"name":"botmatic","email":"kevin+botmatic-npm@botmatic.ai"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/js-jwt_1.0.0_1521740073577_0.15258610500422387"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-22T17:34:33.505Z","1.0.0":"2018-03-22T17:34:33.740Z","modified":"2022-04-04T20:14:09.952Z"},"maintainers":[{"name":"botmatic","email":"kevin+botmatic-npm@botmatic.ai"}],"description":"A simple JWT module to authenticate an integration to external services","license":"ISC","readme":"# JS JWT\nA simple JWT module to authenticate an integration to external services\n\n## Initialisation\n```javascript\n// Initialisation\nconst jwt = require('js-jwt')({\n  url: 'https://my.external-api.com/authorize',\n  contentType: 'application/json',\n  headerName: 'Authorization',\n  headerPrefix: 'Bearer',\n  onResponse: body => body.token || false\n})\n ```\n #### Initialisation parameters\n parameters | type | attributes | description\n ---------- | ---- | ---------- | ---\n url        | string | required | url on an external service to obtain a JSON Web Token\n onResponse | `function(object) -> string or false` | required | receives the response body to the call to `url` and returns the token it contains\n contentType | string | optional, default = `\"application/json\"` | Content-Type for the request sent to `url`\n headerName  | string | optional, default = `\"Authorization\"`| Name for the Authorization header\n headerPrefix | string | optional, default = `\"Bearer\"` | Will be prefix to the token in the Authorization header\n \n ### Obtaining a token\n ```javascript\n// using async / await\nconst header = await jwt.auth({user: \"name\", pass: \"word\"})\n// header == {\"Authorization\": \"Bearer <YOUR_TOKEN>\"}\n\n// using Promises\njwt.auth({user: \"name\", pass: \"word\"})\n  .then(header => {\n    // header == {\"Authorization\": \"Bearer <YOUR_TOKEN>\"}\n  })\n```","readmeFilename":"README.md"}