{"_id":"@bkoti/ngx-oauth-client","_rev":"3-325d6caa8935fb3ff4fc4f61687e1fc4","name":"@bkoti/ngx-oauth-client","dist-tags":{"latest":"15.0.1"},"versions":{"0.3.1":{"name":"@bkoti/ngx-oauth-client","version":"0.3.1","license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/balazskoti/ngx-oauth-client.git"},"scripts":{"total-patch-publish":"run-s test demo.deploy version && npm version patch && npm publish && git push --tags && git push","demo.serve":"ng serve","demo.gh-pages":"gh-pages -d demo/dist","demo.build":"ng build -prod --aot --build-optimizer","demo.copy-readme":"node scripts/copy-readme-to-demo.js","demo.deploy":"run-s demo.build demo.copy-readme demo.gh-pages","release.changelog":"conventional-changelog -i CHANGELOG.md -s -p angular","release.github-release":"conventional-github-releaser -p angular","release":"run-s release.changelog release.github-release","build":"run-s build.clean build.compile","build.clean":"rm -Rf ./dist","build.compile":"ngc -p ./tsconfig.build-lib.json","dev":"ng serve","start":"run-s dev","test":"ng test","test-watch":"ng test","test-coverage":"ng test -cc -sr","link-mod":"rm demo/src/app/component-symlink; cd demo/src/app && ln -s ../../../src component-symlink","coveralls":"YOURPACKAGE_COVERAGE=1 cat ./coverage/lcov.info | ./node_modules/.bin/coveralls","version":"run-s release.changelog build && git add -A","lint":"ng lint","e2e":"ng e2e","ng":"ng"},"main":"dist/index.js","module":"dist/index.js","typings":"dist/index.d.ts","peerDependencies":{"@angular/core":"^6.0.8"},"devDependencies":{"@angular-devkit/build-angular":"^0.6.8","@angular/cli":"^6.0.8","@angular/common":"^6.0.8","@angular/compiler":"^6.0.8","@angular/compiler-cli":"^6.0.8","@angular/core":"^6.0.8","@angular/forms":"^6.0.9","@angular/language-service":"^6.0.8","@angular/platform-browser":"^6.0.9","@angular/platform-browser-dynamic":"^6.0.9","@types/jasmine":"~2.5.53","@types/jasminewd2":"~2.0.2","@types/jquery":"^2.0.48","@types/node":"~6.0.60","angular2-template-loader":"^0.6.2","bootstrap":"^3.3.7","bootstrap-material-design":"^0.5.10","codelyzer":"^4.4.2","colors":"^1.1.2","conventional-changelog-cli":"^1.3.1","conventional-github-releaser":"^1.1.3","coveralls":"^2.13.1","electron":"^1.6.6","gh-pages":"^0.12.0","intl":"^1.2.5","jasmine-core":"~2.6.2","jasmine-spec-reporter":"~4.1.0","karma":"2.0.4","karma-chrome-launcher":"~2.1.1","karma-cli":"~1.0.1","karma-coverage-istanbul-reporter":"^1.2.1","karma-jasmine":"1.1.2","karma-jasmine-html-reporter":"^0.2.2","karma-phantomjs-launcher":"^1.0.4","marked":"^0.3.6","node-sass":"^4.6.0","npm-run-all":"^4.0.2","protractor":"~5.1.2","reflect-metadata":"^0.1.10","rxjs":"^6.0.0","ts-node":"~3.2.0","tslint":"~5.7.0","typescript":"~2.7.2","wallaby-webpack":"0.0.38","web-animations-js":"^2.2.5","zone.js":"^0.8.26"},"gitHead":"a9ed78c1cf912c166ed2e0bf966d6cc04f660380","description":"[![npm version](https://badge.fury.io/js/ngx-oauth-client.svg)](https://badge.fury.io/js/ngx-oauth-client) [![Build Status](https://travis-ci.org/0xMatt/ngx-oauth-client.svg)](https://travis-ci.org/0xMatt/ngx-oauth-client?branch=master) [![Coverage Status","bugs":{"url":"https://github.com/balazskoti/ngx-oauth-client/issues"},"homepage":"https://github.com/balazskoti/ngx-oauth-client#readme","_id":"@bkoti/ngx-oauth-client@0.3.1","_nodeVersion":"8.11.4","_npmVersion":"6.8.0","dist":{"integrity":"sha512-mzT5gkRkS6ZK0vMfWH8SPDimPZf9RM8WdZFw7f08nLStHWDN6kOV3r3vWtJSJbsn9+dIXtbiydLfDDDVJgnt/A==","shasum":"11aabad70d231c40a7d0d5d44aa1f9946e20f745","tarball":"https://registry.npmjs.org/@bkoti/ngx-oauth-client/-/ngx-oauth-client-0.3.1.tgz","fileCount":40,"unpackedSize":46471,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcfRgYCRA9TVsSAnZWagAA0sIP/RTkPi030pB76F6S7cqr\nghlLGesr9EivmNnjeGpAICOXRgjiAozriEIL2kcD6hVsDMjalWCAFW8EXnCU\nFlQd+MnXCztZXlHRYr8221OPUdbpKlWzi1fOKtKbQhEFIL+RsXkrJCciX+iu\nDC52Hd2UIRFOVyT9jV3O7UOqc4F+DBlWZKtdN/Gn75Xbj5CW96koyzOastDG\nnCXvwoFqJtyAT9pOJyS4ew6FQaxKoNNfhvlEfH8RkP7IUwBJWHcvo/mHKSqb\n+rTP2C2890bL/Nf3LFGgg7ck55CT/zGEvt9V3YaZM7GZEDoUMgd8BFP70NaS\njWNtlrrCeSRvoZLStklFUPNLEdAdXLK4smQr7dtlkEgi1s4831snwEuViWNG\nvc6zEw7YGyVwfB05fgF6RZI9lCiYrFuNFdIIwAa5cMLEnqlpb0k3AZm8eveO\nlsYmi0l0xDunwPtPajnjVZAQpTAk0lz/lzIkHxaxIsX0BuXHW3IT5Usl6wiU\nil7jJCer5EcyxtSyr4yxJzdkQAvk/rZUUTE3rIWxzzbjhW7V8dLyaLbL4Lqg\nZPxaNAon2Ca+lYFv8HMhHD4tcnZOVIhuOtRcIgoGix+Y/+mniVCLlb4C5V7r\nQSDJ45fAbsMKI9h3iFZp1MxgP+XT1mgwM1d4Zi6kcI6GwIH6GeY3m21tzyFk\nL6TX\r\n=aUP6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDATmdPet2pyduXN5mK9Ieuf+X1b3ClkoWmxU6JmLt1NwIhAKpZfe4GHWkMzKe/dh12ZbS6ctHAOuGAtqU1mLI7BR2F"}]},"maintainers":[{"name":"bkoti","email":"balazs.koti@voodoopark.com"}],"_npmUser":{"name":"bkoti","email":"balazs.koti@voodoopark.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ngx-oauth-client_0.3.1_1551702039575_0.23824838037068163"},"_hasShrinkwrap":false},"15.0.0":{"name":"@bkoti/ngx-oauth-client","version":"15.0.0","license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/0xMatt/ngx-oauth-client.git"},"scripts":{"total-patch-publish":"run-s test demo.deploy version && npm version patch && npm publish && git push --tags && git push","demo.serve":"ng serve","demo.gh-pages":"gh-pages -d demo/dist","demo.build":"ng build -prod --aot --build-optimizer","demo.copy-readme":"node scripts/copy-readme-to-demo.js","demo.deploy":"run-s demo.build demo.copy-readme demo.gh-pages","release.changelog":"conventional-changelog -i CHANGELOG.md -s -p angular","release.github-release":"conventional-github-releaser -p angular","release":"run-s release.changelog release.github-release","build":"run-s build.clean build.compile","build.clean":"rm -Rf ./dist","build.compile":"ngc -p ./tsconfig.build-lib.json","dev":"ng serve","start":"run-s dev","test":"ng test -sr","test-watch":"ng test","test-coverage":"ng test -cc -sr","link-mod":"rm demo/src/app/component-symlink; cd demo/src/app && ln -s ../../../src component-symlink","coveralls":"YOURPACKAGE_COVERAGE=1 cat ./coverage/lcov.info | ./node_modules/.bin/coveralls","version":"run-s release.changelog build && git add -A","lint":"ng lint","e2e":"ng e2e","ng":"ng"},"main":"dist/index.js","module":"dist/index.js","typings":"dist/index.d.ts","dependencies":{"@angular/animations":"^15.2.9","@angular/common":"^15.2.9"},"devDependencies":{"@angular/cli":"^15.2.9","@angular/common":"^15.2.9","@angular/compiler":"^15.2.9","@angular/compiler-cli":"^5.2.0","@angular/core":"^15.2.9","@angular/forms":"^15.2.9","@angular/platform-browser":"^15.2.9","@angular/platform-browser-dynamic":"^15.2.9","@angular/platform-server":"^15.2.9","@angular/router":"^15.2.9","@types/core-js":"^0.9.41","@types/jasmine":"2.5.38","@types/node":"^12.11.1","angular2-template-loader":"^0.6.2","bootstrap":"^3.3.7","bootstrap-material-design":"^0.5.10","codelyzer":"^6.0.0","conventional-changelog-cli":"^1.3.1","conventional-github-releaser":"^1.1.3","coveralls":"^2.13.1","electron":"^1.6.6","gh-pages":"^0.12.0","intl":"^1.2.5","jasmine-core":"~2.8.0","jasmine-spec-reporter":"~4.2.1","karma":"~2.0.0","karma-chrome-launcher":"~2.0.0","karma-cli":"~1.0.1","karma-coverage-istanbul-reporter":"^1.2.1","karma-jasmine":"~1.1.0","karma-jasmine-html-reporter":"^0.2.2","karma-phantomjs-launcher":"^1.0.4","marked":"^0.3.6","npm-run-all":"^4.0.2","protractor":"~5.1.0","reflect-metadata":"^0.1.10","rxjs":"^7.5.7","ts-node":"~6.1.0","tslint":"~6.1.0","typescript":"~4.8.0","wallaby-webpack":"0.0.38","web-animations-js":"^2.2.5","zone.js":"~0.11.4"},"gitHead":"60a5f9a6159fc5658cff85a808787b01224dcf9d","description":"[![npm version](https://badge.fury.io/js/ngx-oauth-client.svg)](https://badge.fury.io/js/ngx-oauth-client) [![Build Status](https://travis-ci.org/0xMatt/ngx-oauth-client.svg)](https://travis-ci.org/0xMatt/ngx-oauth-client?branch=master) [![Coverage Status","bugs":{"url":"https://github.com/0xMatt/ngx-oauth-client/issues"},"homepage":"https://github.com/0xMatt/ngx-oauth-client#readme","_id":"@bkoti/ngx-oauth-client@15.0.0","_nodeVersion":"18.17.0","_npmVersion":"8.3.0","dist":{"integrity":"sha512-2agOpp7ZwYMwTjaO0V5x1iQyNb6d0iSELc+WTulv54zWWQ9eYSE+htPoGu5uhYD1WcYtoTYS3N5KtR2l3ABLeA==","shasum":"09ca7e72e7426a49de89a438757debc05ffac4c4","tarball":"https://registry.npmjs.org/@bkoti/ngx-oauth-client/-/ngx-oauth-client-15.0.0.tgz","fileCount":40,"unpackedSize":50555,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSuiK7pkZeNECKvv3a9abNT67YhSW6WklWhHIuAqq8FAIgSGNh3HJ3tpDx47N/6VQ6vTL/LXJB7p3bOrp8zkrxYU4="}]},"_npmUser":{"name":"bkoti","email":"balazs.koti@voodoopark.com"},"directories":{},"maintainers":[{"name":"bkoti","email":"balazs.koti@voodoopark.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ngx-oauth-client_15.0.0_1690590555212_0.05120665790342205"},"_hasShrinkwrap":false},"15.0.1":{"name":"@bkoti/ngx-oauth-client","version":"15.0.1","license":"MIT","repository":{"type":"git","url":"git+ssh://git@github.com/0xMatt/ngx-oauth-client.git"},"scripts":{"total-patch-publish":"run-s test demo.deploy version && npm version patch && npm publish && git push --tags && git push","demo.serve":"ng serve","demo.gh-pages":"gh-pages -d demo/dist","demo.build":"ng build -prod --aot --build-optimizer","demo.copy-readme":"node scripts/copy-readme-to-demo.js","demo.deploy":"run-s demo.build demo.copy-readme demo.gh-pages","release.changelog":"conventional-changelog -i CHANGELOG.md -s -p angular","release.github-release":"conventional-github-releaser -p angular","release":"run-s release.changelog release.github-release","build":"run-s build.clean build.compile","build.clean":"del dist","build.compile":"ngc -p ./tsconfig.build-lib.json","dev":"ng serve","start":"run-s dev","test":"ng test -sr","test-watch":"ng test","test-coverage":"ng test -cc -sr","link-mod":"rm demo/src/app/component-symlink; cd demo/src/app && ln -s ../../../src component-symlink","coveralls":"YOURPACKAGE_COVERAGE=1 cat ./coverage/lcov.info | ./node_modules/.bin/coveralls","version":"run-s release.changelog build && git add -A","lint":"ng lint","e2e":"ng e2e","ng":"ng"},"main":"dist/index.js","module":"dist/index.js","typings":"dist/index.d.ts","type":"module","dependencies":{"@angular/animations":"^15.2.9","@angular/common":"^15.2.9"},"devDependencies":{"@angular/cli":"^15.2.9","@angular/common":"^15.2.9","@angular/compiler":"^15.2.9","@angular/compiler-cli":"^15.2.9","@angular/core":"^15.2.9","@angular/forms":"^15.2.9","@angular/platform-browser":"^15.2.9","@angular/platform-browser-dynamic":"^15.2.9","@angular/platform-server":"^15.2.9","@angular/router":"^15.2.9","@types/core-js":"^0.9.41","@types/jasmine":"2.5.38","@types/node":"^12.11.1","angular2-template-loader":"^0.6.2","bootstrap":"^3.3.7","bootstrap-material-design":"^0.5.10","codelyzer":"^6.0.0","conventional-changelog-cli":"^1.3.1","conventional-github-releaser":"^1.1.3","coveralls":"^2.13.1","electron":"^1.6.6","gh-pages":"^0.12.0","intl":"^1.2.5","jasmine-core":"~2.8.0","jasmine-spec-reporter":"~4.2.1","karma":"~2.0.0","karma-chrome-launcher":"~2.0.0","karma-cli":"~1.0.1","karma-coverage-istanbul-reporter":"^1.2.1","karma-jasmine":"~1.1.0","karma-jasmine-html-reporter":"^0.2.2","karma-phantomjs-launcher":"^1.0.4","marked":"^0.3.6","npm-run-all":"^4.0.2","protractor":"~5.1.0","reflect-metadata":"^0.1.10","rxjs":"^7.5.7","ts-node":"~6.1.0","tslint":"~6.1.0","typescript":"~4.8.0","wallaby-webpack":"0.0.38","web-animations-js":"^2.2.5","zone.js":"~0.11.4"},"gitHead":"b98f8984c010e9aa720536e1164815dcbbda8333","description":"[![npm version](https://badge.fury.io/js/ngx-oauth-client.svg)](https://badge.fury.io/js/ngx-oauth-client) [![Build Status](https://travis-ci.org/0xMatt/ngx-oauth-client.svg)](https://travis-ci.org/0xMatt/ngx-oauth-client?branch=master) [![Coverage Status","bugs":{"url":"https://github.com/0xMatt/ngx-oauth-client/issues"},"homepage":"https://github.com/0xMatt/ngx-oauth-client#readme","_id":"@bkoti/ngx-oauth-client@15.0.1","_nodeVersion":"18.17.0","_npmVersion":"8.3.0","dist":{"integrity":"sha512-42h35CoZl1s1POV1tJnfCB98eESpHipg67OjyO0msktEvxk/oSZ9+FEktG5V9AomtVN5WFu8rLEbOmwkSy5mrg==","shasum":"c3a74839040d3146f04b29d22a556cc4e02a7967","tarball":"https://registry.npmjs.org/@bkoti/ngx-oauth-client/-/ngx-oauth-client-15.0.1.tgz","fileCount":31,"unpackedSize":44796,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIASdk4u0bE66Rb7Eh5kl7KV6spNtZ2+B8+PfdSAJKKRsAiAt6JwepwHlkn0nbS+OaRhIlurSgifyYhlyiKeJ3oZpvQ=="}]},"_npmUser":{"name":"bkoti","email":"balazs.koti@voodoopark.com"},"directories":{},"maintainers":[{"name":"bkoti","email":"balazs.koti@voodoopark.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ngx-oauth-client_15.0.1_1690591281782_0.33416622400660345"},"_hasShrinkwrap":false}},"time":{"created":"2019-03-04T12:20:39.369Z","0.3.1":"2019-03-04T12:20:39.717Z","modified":"2023-07-29T00:41:22.094Z","15.0.0":"2023-07-29T00:29:15.372Z","15.0.1":"2023-07-29T00:41:21.985Z"},"maintainers":[{"name":"bkoti","email":"balazs.koti@voodoopark.com"}],"description":"[![npm version](https://badge.fury.io/js/ngx-oauth-client.svg)](https://badge.fury.io/js/ngx-oauth-client) [![Build Status](https://travis-ci.org/0xMatt/ngx-oauth-client.svg)](https://travis-ci.org/0xMatt/ngx-oauth-client?branch=master) [![Coverage Status","homepage":"https://github.com/0xMatt/ngx-oauth-client#readme","repository":{"type":"git","url":"git+ssh://git@github.com/0xMatt/ngx-oauth-client.git"},"bugs":{"url":"https://github.com/0xMatt/ngx-oauth-client/issues"},"license":"MIT","readme":"[![npm version](https://badge.fury.io/js/ngx-oauth-client.svg)](https://badge.fury.io/js/ngx-oauth-client)\n[![Build Status](https://travis-ci.org/0xMatt/ngx-oauth-client.svg)](https://travis-ci.org/0xMatt/ngx-oauth-client?branch=master)\n[![Coverage Status](https://coveralls.io/repos/github/0xMatt/ngx-oauth-client/badge.svg?branch=master)](https://coveralls.io/github/0xMatt/ngx-oauth-client?branch=master)\n\nngx-oauth-client\n===========\n\n*ngx-oauth-client* is an Angular4 HTTP/OAuth2 client utilizing the HttpClient. This package allows you to set up multiple clients to interface with many OAuth2 compliant APIs.\n\nCheck out the [demo](http://0xMatt.github.io/ngx-oauth-client/#demo)!\n\n[Bug-reports or feature request](https://github.com/0xMatt/ngx-oauth-client/issues) are welcome!\n\n## Getting started\nInstall it via npm:\n```\nnpm install ngx-oauth-client -S\n```\nAnd add it as a dependency to your main module\n```typescript\nimport {NgxOAuthModule} from 'ngx-oauth-client';\n@NgModule({\n  imports: [\n    NgxOAuthModule\n  ],\n})\nexport class AppModule {\n}\n```\nUsing the library is easy, just create your extending class and configure it:\n\n```typescript\nimport {NgxOAuthClient, DefaultHeaders, Configuration} from 'ngx-oauth-client';\n@Configuration({\n  host: 'https://jsonplaceholder.typicode.com'\n})\n@DefaultHeaders({\n  'Content-Type': 'application/json',\n  'Accept': 'application/json'\n})\nexport class MyApiClient extends NgxOAuthClient {\n\n}\n\n```\n\n## Configuration\nConfiguration is done via the Configuration decorator, the api is simple\n```typescript\ninterface NgxOAuthConfig {\n  host: string;\n  token?: string;\n  key?: string;\n  secret?: string;\n  storage_prefix? string;\n}\n\n```\n\n## OAuth2.0\n\nBuilt-in support for authenticating via OAuth2 has been provided, you can use the `getToken` method to perform any authentication method to retrieve a token from the OAuth server.\n\nYou may use `fetchToken(key?)` to retrieve details about a specific token property or get the entire `NgxOAuthResponse` object by not supplying a value to the function parameter.\n\n## Client Credentials\n\n```typescript\nMyApiClient.getToken().subscribe((token: NgxOAuthResponse) => {\n  // Token is already set for you\n  MyApiClient.fetchToken('access_token'); // your_token_from_response\n});\n```\n\n## Password\n```typescript\nMyApiClient.getToken('password', {\n  username: 'bob',\n  password: '123123'\n}).subscribe((token: NgxOAuthResponse) => {\n  // Token is already set for you\n  MyApiClient.fetchToken('access_token'); // your_access_token_from_response\n  MyApiClient.fetchToken('refresh_token'); // your_refresh_token_from_response\n});\n```\n\n## Authorization Code\n\n```typescript\nMyApiClient.getToken('authorization_code', {authorization_code: '123'}.subscribe((token: NgxOAuthResponse) => {\n  // Token is already set for you\n  MyApiClient.fetchToken('access_token'); // your_access_token_from_response\n  MyApiClient.fetchToken('refresh_token'); // your_refresh_token_from_response\n});\n```\n\n## Interceptors\n\nWhile the HttpClient now providers interceptors, they are in fact global. Having interceptor methods allows you to have client-specific interceptor rules.\n\n### Request Interceptor\n\nThe example demonstrates adding an authorization header to your requests if your criteria is met.\n\n```typescript\nrequestInterceptor(request) {\n    const auth = this.fetchToken();\n    if (auth) {\n      return request.setHeaders({Authorization: auth.token_type + auth.access_token});\n    }\n\n    return request;\n}\n```\n\n### Response Interceptor\n\nThe response interceptor allows you to modify the return value from requests\n\n```typescript\nresponseInterceptor(request, response) {\n  console.info(`Response from ${request.url}`, response);\n  return response;\n}\n\n```\n\n\n### Error Interceptor\n\nThe error interceptor allows you to handle erroneous requests\n\n```typescript\nerrorInterceptor(request, error): Observable<any> {\n  if (error.status === 401) {\n    const refresh_token = this.fetchToken('refresh_token');\n    if (!refresh_token) {\n      return Observable.throw(error);\n    }\n    return this.getToken('refresh_token', {refresh_token}).switchMap(token => {\n      return this.getClient().request(\n        request.method,\n        request.url,\n        this.requestInterceptor(request.setHeaders({Authorization: `${token.token_type} ${token.access_token}`}))\n      );\n    });\n  }\n  return Observable.throw(error);\n}\n\n```\n\n### Credits\n\n - [KnetikCloud](http://knetikcloud.com) for providing the backend service that the demo utilizes\n - [@johannesjo](https://github.com/johannesjo) for his [angular generator](https://github.com/johannesjo/generator-angular2-lib) used for building this library\n","readmeFilename":"README.md"}