# ngx-jwt

> [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) [![Node.js CI](https://github.com/rars/ngx-jwt/actions/workflows/node.js.yml/badge.svg)](https://github.com/rars/ngx-jwt/acti

Latest version **4.0.0** (published 2024-06-06) · 0 weekly downloads

## Install

```sh
npm install ngx-jwt
pnpm add ngx-jwt
yarn add ngx-jwt
bun add ngx-jwt
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2024-06-06 |
| First published | 2018-01-06 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 48.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Richard Russell |
| Maintainers | rars |

## Links

- npm: https://www.npmjs.com/package/ngx-jwt
- Repository: https://github.com/rars/ngx-jwt
- Homepage: https://github.com/rars/ngx-jwt#readme
- Issues: https://github.com/rars/ngx-jwt/issues
- npm.io page: https://npm.io/package/ngx-jwt

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.0.0

## Recent versions

- 4.0.0 (latest) — 2024-06-06
- 3.0.0 — 2023-11-08
- 2.0.0 — 2023-05-04
- 1.0.0 — 2022-02-22
- 0.5.0 — 2020-06-06
- 0.4.0 — 2019-10-08
- 0.3.0 — 2018-05-12
- 0.2.0 — 2018-02-08
- 0.1.0 — 2018-01-28
- 0.0.1 — 2018-01-06

## README

# ngx-jwt

[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![Node.js CI](https://github.com/rars/ngx-jwt/actions/workflows/node.js.yml/badge.svg)](https://github.com/rars/ngx-jwt/actions/workflows/node.js.yml)

Angular4+ module for adding JWT authorisation tokens to HTTP requests.

## Quickstart

1. Install `ngx-jwt` modules from npm:
   ```
   npm install ngx-jwt --save
   ```
2. Import `NgxJwtModule` to your app:

   ```
   import { BrowserModule } from '@angular/platform-browser';
   import { NgModule } from '@angular/core';
   import { of } from 'rxjs';
   import { NgxJwtModule, NgxJwtConfig } from 'ngx-jwt';
   import { AppComponent } from './app.component';

   export function createNgxJwtConfig(): NgxJwtConfig {
     return {
       tokenGetter: () => of('TOKEN'),
       blacklistedDomains: ['auth-service'],
       whitelistedDomains: [],
       throwNoTokenError: true,
       skipWhenExpired: false,
       headerName: 'Authorization',
       authScheme: 'Bearer'
     };
   }

   @NgModule({
     declarations: [
       AppComponent
     ],
     imports: [
       BrowserModule,
       NgxJwtModule.forRoot({
         provider: {
           provide: NgxJwtConfig,
           useFactory: createNgxJwtConfig
         }
       })
     ],
     providers: [],
     bootstrap: [AppComponent]
   })
   export class AppModule { }
   ```

## Compatibility

Recommended versions by Angular version:

| Angular | ngx-jwt |
| ------- | ------- |
| ^4.3.0  | ^0.2.0  |
| ^5.0.0  | ^0.2.0  |
| ^6.0.0  | ^0.3.0  |
| ^7.0.0  | ^0.3.0  |
| ^8.0.0  | ^0.4.0  |
| ^9.0.0  | ^0.5.0  |
| ^13.0.0 | ^1.0.0  |
| ^16.0.0 | ^2.0.0  |
| ^17.0.0 | ^3.0.0  |
| ^18.0.0 | ^4.0.0  |

## Contributions welcome!

If you have a feature or improvement you would like to see included, please raise an issue or a PR and I will review.

## License

See the [LICENSE](LICENSE.md) file for license rights and limitations (MIT).

---
_Source: https://npm.io/package/ngx-jwt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
