{"_id":"@egomobile/oauth2-client","_rev":"7-6ce79c4f30e7e75daf90867580300b82","name":"@egomobile/oauth2-client","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@egomobile/oauth2-client","version":"0.1.0","description":"Creates and setups pre-configured axios clients, using OAuth 2.0 workflow(s).","main":"lib/index.js","engines":{"node":">=12.0.0"},"scripts":{"build":"del ./lib && tsc","docs:generate":"del ./docs && typedoc --out ./docs ./src","lint":"eslint -c .eslintrc.js --ext .ts src","lint:fix":"eslint --fix -c .eslintrc.js --ext .ts src","sandbox":"nodemon --watch './sandbox.ts' --exec node -r ts-node/register --inspect=0.0.0.0:9229 ./sandbox.ts"},"repository":{"type":"git","url":"git+https://github.com/egomobile/node-oauth2-client.git"},"keywords":["node","http","client","axios","oauth","oauth2","client credentials","bearer","token","workflows","jwt","json web token","javascript","typescript","ego"],"author":{"name":"Next.e.GO Mobile SE, Aachen, Germany"},"license":"LGPL-3.0","dependencies":{"@types/node":"^12.20.33","axios":"^0.23.0"},"devDependencies":{"@egomobile/tsconfig":"^5.0.0","del-cli":"^4.0.1","eslint":"^7.32.0","eslint-config-ego":"^0.15.0","nodemon":"^2.0.13","ts-node":"^10.2.1","tslint":"^6.1.3","typedoc":"^0.22.5","typescript":"^4.4.3"},"gitHead":"53d2fe3225515ad3e66deda4c0c5b72eac19fcf1","bugs":{"url":"https://github.com/egomobile/node-oauth2-client/issues"},"homepage":"https://github.com/egomobile/node-oauth2-client#readme","_id":"@egomobile/oauth2-client@0.1.0","_nodeVersion":"12.22.6","_npmVersion":"6.14.15","dist":{"integrity":"sha512-G/+txVj3JKsMySNOaEOrEgpPY5K35qciAcj6shgZliGuwF675cPtY6MGQlFlp9/p96CDkYSeoCAcMBFTR2j8dw==","shasum":"54b676c2b339c2205489d4d5f4cc278dcfa14986","tarball":"https://registry.npmjs.org/@egomobile/oauth2-client/-/oauth2-client-0.1.0.tgz","fileCount":10,"unpackedSize":24251,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDZAwql+n6OsJY2DGA3RZOL1ShRlVWsQWQ8Ar6zERmr8wIgd9mYkXzZil9VvDNUeRLpPkI+3rkzqvEuvqiTivrAcDM="}]},"_npmUser":{"name":"mkloubertego","email":"marcel.kloubert@e-go-mobile.com"},"directories":{},"maintainers":[{"name":"mkloubertego","email":"marcel.kloubert@e-go-mobile.com"},{"name":"mkloubert","email":"marcel.kloubert@gmx.net"},{"name":"ekegodigital","email":"eric.kesseler@e-go-digital.com"},{"name":"ml-ego","email":"marc.lutter@e-go-mobile.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/oauth2-client_0.1.0_1634757681764_0.9961432549219755"},"_hasShrinkwrap":false},"0.2.0":{"name":"@egomobile/oauth2-client","version":"0.2.0","description":"Creates and setups pre-configured axios clients, using OAuth 2.0 workflow(s).","main":"lib/index.js","engines":{"node":">=12.0.0"},"scripts":{"build":"del ./lib && tsc","docs:generate":"del ./docs && typedoc --out ./docs ./src","lint":"eslint -c .eslintrc.js --ext .ts src","lint:fix":"eslint --fix -c .eslintrc.js --ext .ts src","sandbox":"nodemon --watch './sandbox.ts' --exec node -r ts-node/register --inspect=0.0.0.0:9229 ./sandbox.ts"},"repository":{"type":"git","url":"git+https://github.com/egomobile/node-oauth2-client.git"},"keywords":["node","http","client","axios","oauth","oauth2","client credentials","password","username","bearer","token","workflows","jwt","json web token","javascript","typescript","ego"],"author":{"name":"Next.e.GO Mobile SE, Aachen, Germany"},"license":"LGPL-3.0","dependencies":{"@types/node":"^12.20.33","axios":"^0.23.0"},"devDependencies":{"@egomobile/tsconfig":"^5.0.0","del-cli":"^4.0.1","eslint":"^7.32.0","eslint-config-ego":"^0.15.0","nodemon":"^2.0.13","ts-node":"^10.2.1","tslint":"^6.1.3","typedoc":"^0.22.5","typescript":"^4.4.3"},"gitHead":"ae16d2f8b44879a7eae2005d49e6037bc66ce375","bugs":{"url":"https://github.com/egomobile/node-oauth2-client/issues"},"homepage":"https://github.com/egomobile/node-oauth2-client#readme","_id":"@egomobile/oauth2-client@0.2.0","_nodeVersion":"12.22.6","_npmVersion":"6.14.15","dist":{"integrity":"sha512-v6zHpDUyLi3UvWZHAICY31A6VJrp30Aqo+kz4AUotOxHnLnAH/ymc4bgAO4LF1zDowCV3fUDEZGdUTgqyBrrsA==","shasum":"e5cd581461a76d37e27f9d2a41ffeb4ebb867695","tarball":"https://registry.npmjs.org/@egomobile/oauth2-client/-/oauth2-client-0.2.0.tgz","fileCount":16,"unpackedSize":40443,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2FfHCRA9TVsSAnZWagAAMxcP/3kb3P6b3QgxKckEdC1Y\n1/Wi5pUF8vJDcbcc9d99cyPUuMEIvP7dqYwIwATedu4H1m9EsBLo4p8esZgo\nT5W6og+QN9sfKdjCOUmAagrkA3aqfWHO1bDu2baHWpZfwBuQLjMpIqplmH+a\niadPIUOXVcmynkbUmQXsbzSbPm2jyuxHHB0SaAqt76W5oce1Lrsd77cHDMSY\nJdh/9zeQ+BBhSfnMlYVSmCIYoEyFNP53RJPKGcy3M1N4QN1GVknjKHvMGqR6\nv2fc6+1QdmTp8ylvf2nJI0kxVQdTvQJUVpdsLgGSX3RxgGoZ0pz9/fQ0fPey\nQfPeZImtyz2rRdkY75Rj5wr8eNAOrUZxJLK+ShZYVTB1enLujznDZ8Hh2f7+\n9u9inS1XuCCo2AVfHjaM+4agje1pJS5GGsAB2GILJwgWNp0CIF7BgjR2pfB/\nXdTmuw8WkjY3pFrQvCbKWLDYxdwFnICR7D7s4HBna1Hf+JYkGjoDr+4m9NfZ\n9ZkZu92QBkxq4TOY1+uoJ/mdaup5tRolIaSpefPrbu+uIZGfY7ueIC9FkIeS\nCo6/TbT9/7cU4CgAMN3+4gblOhKXhoFeZopKzUMKz3DboDc5eBKGrDyK9wXN\nBLTk6edd/4OntIxln5z8S146WW9jdsQZFk8W1thtycfQ6qKsGFvhLAhQQadS\n+0OV\r\n=8nPB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAcHzlfbOSPQPpq6KusauXj76p/63anIEOtHPwebpO+TAiBVAkkUQr6oV04mQcJ0PFu+QFWdVEKxG07jPHMoENw+9g=="}]},"_npmUser":{"name":"mkloubertego","email":"marcel.kloubert@e-go-mobile.com"},"directories":{},"maintainers":[{"name":"mkloubertego","email":"marcel.kloubert@e-go-mobile.com"},{"name":"mkloubert","email":"marcel.kloubert@gmx.net"},{"name":"ekegodigital","email":"eric.kesseler@e-go-digital.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/oauth2-client_0.2.0_1634797736360_0.06081542947761576"},"_hasShrinkwrap":false}},"time":{"created":"2021-10-20T19:21:21.716Z","0.1.0":"2021-10-20T19:21:21.915Z","modified":"2024-05-22T18:03:47.110Z","0.2.0":"2021-10-21T06:28:56.527Z"},"maintainers":[{"email":"eric.kesseler@e-go-mobile.com","name":"ekmobile"},{"email":"dux-developer@e-go-mobile.com","name":"egodux"},{"email":"marcel.kloubert@gmx.net","name":"mkloubert"},{"email":"eric.kesseler@e-go-digital.com","name":"ekegodigital"}],"description":"Creates and setups pre-configured axios clients, using OAuth 2.0 workflow(s).","homepage":"https://github.com/egomobile/node-oauth2-client#readme","keywords":["node","http","client","axios","oauth","oauth2","client credentials","password","username","bearer","token","workflows","jwt","json web token","javascript","typescript","ego"],"repository":{"type":"git","url":"git+https://github.com/egomobile/node-oauth2-client.git"},"author":{"name":"Next.e.GO Mobile SE, Aachen, Germany"},"bugs":{"url":"https://github.com/egomobile/node-oauth2-client/issues"},"license":"LGPL-3.0","readme":"[![npm](https://img.shields.io/npm/v/@egomobile/oauth2-client.svg)](https://www.npmjs.com/package/@egomobile/oauth2-client)\n[![last build](https://img.shields.io/github/workflow/status/egomobile/node-oauth2-client/Publish)](https://github.com/egomobile/node-oauth2-client/actions?query=workflow%3APublish)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/egomobile/node-oauth2-client/pulls)\n\n# @egomobile/oauth2-client\n\n> Creates and setups pre-configured [axios](https://github.com/axios/axios) clients, using OAuth 2.0 workflow(s)., written in [TypeScript](https://www.typescriptlang.org/).\n\n## Install\n\nExecute the following command from your project folder, where your `package.json` file is stored:\n\n```bash\nnpm install --save @egomobile/oauth2-client\n```\n\n## Usage\n\n### client_credentials\n\n```typescript\nimport { createClientCredentialsClientFactory } from \"@egomobile/oauth2-client\";\n\n// create a factory function, that creates\n// a pre-configured API client that already\n// has an access_token, submitted as Bearer by default\nexport const createApiClient = createClientCredentialsClientFactory({\n  // data for client authorization\n  auth: {\n    clientId: \"foo\",\n    clientSecret: \"bar\",\n  },\n\n  // base URL of the API\n  baseURL: \"https://api.example.com\",\n  // URL from where to get the token from\n  tokenURL: \"https://api.example.com/oauth2/token\",\n\n  // optional extra default headers\n  headers: {\n    \"x-baz\": \"some value for an extra header\",\n  },\n\n  // optional and additional / custom\n  // axios configuration\n  config: {\n    // this always accept any status code\n    // and will now throw errors on HTTP error codes\n    validateStatus: (status) => status < 400,\n  },\n});\n\nfunction doApiCall() {\n  // create client with the new factory\n  // without subitting the credentials\n  // every time\n  const client = await createClient();\n\n  // now, do some API call with a pre-configured client\n  // that submits the access_token as Bearer via\n  // Authorization header\n  return client.get(\"/foo?bar=baz\"); // [GET] https://api.example.com/foo?bar=baz\n}\n\nconst response = await doApiCall();\n```\n\n### password\n\n```typescript\nimport { createPasswordClientFactory } from \"@egomobile/oauth2-client\";\n\n// create a factory function, that creates\n// a pre-configured API client that already\n// has an access_token, submitted as Bearer by default\nexport const createApiClient = createPasswordClientFactory({\n  // data for client authorization\n  auth: {\n    clientId: \"foo\",\n    clientSecret: \"bar\",\n    username: \"bill\",\n    password: \"G@tes1234!\",\n  },\n\n  // base URL of the API\n  baseURL: \"https://api.example.com\",\n  // URL from where to get the token from\n  tokenURL: \"https://api.example.com/oauth2/token\",\n\n  // optional extra default headers\n  headers: {\n    \"x-baz\": \"some value for an extra header\",\n  },\n\n  // optional and additional / custom\n  // axios configuration\n  config: {\n    // this always accept any status code\n    // and will now throw errors on HTTP error codes\n    validateStatus: (status) => status < 400,\n  },\n});\n\nfunction doApiCall() {\n  // create client with the new factory\n  // without subitting the credentials\n  // every time\n  const client = await createClient();\n\n  // now, do some API call with a pre-configured client\n  // that submits the access_token as Bearer via\n  // Authorization header\n  return client.get(\"/foo?bar=baz\"); // [GET] https://api.example.com/foo?bar=baz\n}\n\nconst response = await doApiCall();\n```\n\n## Documentation\n\nThe API documentation can be found [here](https://egomobile.github.io/node-oauth2-client/).\n","readmeFilename":"README.md"}