# adal-ng5

> ADAL wrapper for Angular5.

Latest version **1.3.3** (published 2020-02-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install adal-ng5
pnpm add adal-ng5
yarn add adal-ng5
bun add adal-ng5
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.3 |
| Published | 2020-02-11 |
| First published | 2018-10-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 42.2 KB |
| Known vulnerabilities | 0 (+13 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Salim Draoui |
| Maintainers | salimdr |
| Keywords | adal, angular5, adfs, AzureAD |

## Links

- npm: https://www.npmjs.com/package/adal-ng5
- Repository: https://github.com/SalimDr/adal-angular5
- Homepage: https://github.com/SalimDr/adal-angular5#readme
- Issues: https://github.com/SalimDr/adal-angular5/issues
- npm.io page: https://npm.io/package/adal-ng5

## Dependencies (6)

- [rxjs](https://npm.io/package/rxjs.md) ^5.5.2
- [zone.js](https://npm.io/package/zone.js.md) ^0.8.14
- [adal-angular](https://npm.io/package/adal-angular.md) =1.0.16
- [@angular/core](https://npm.io/package/@angular/core.md) ^5.0.0
- [@angular/common](https://npm.io/package/@angular/common.md) ^5.0.0
- [@angular/platform-browser](https://npm.io/package/@angular/platform-browser.md) ^5.0.0

## Recent versions

- 1.3.3 (latest) — 2020-02-11
- 1.3.2 — 2020-01-27
- 1.3.1 — 2020-01-27
- 1.3.0 — 2020-01-09
- 1.2.5 — 2020-01-09
- 1.2.4 — 2020-01-09
- 1.2.3 — 2020-01-09
- 1.2.0 — 2020-01-09
- 1.1.9 — 2019-12-13
- 1.1.10 — 2019-12-13
- 1.1.8 — 2019-11-04
- 1.1.7 — 2018-11-09
- 1.1.5 — 2018-10-29
- 1.1.4 — 2018-10-29
- 1.1.0 — 2018-10-29
- … 1 more at https://npm.io/package/adal-ng5/versions

## README

# adal-angular5
![build status](https://travis-ci.org/grumar/adal-angular5.svg?branch=master)


___

Angular 5 Active Directory Authentication Library (ADAL) wrapper package. Can be used to authenticate Angular 5 applications to Azure Active Directory.

Based on https://github.com/benbaran/adal-angular4.


## How to use it
> IMPORTANT!

Don't use `Http` and `HttpModule`, You definitely must use `HttpClient` and `HttpClientModule` instead of them.
The new interceptor is used only for request made by `HttpClient`.
When old `Http` used request will be untouched (no authorization header).

In `app.module.ts`

```typescript
import { HttpClient, HttpClientModule } from '@angular/common/http';
...
    imports: [..., HttpClientModule  ], // important! HttpClientModule replaces HttpModule
    providers: [
        Adal5Service,
        { provide: Adal5HTTPService, useFactory: Adal5HTTPService.factory, deps: [HttpClient, Adal5Service] } //  // important! HttpClient replaces Http
  ]
```

## Example

```typescript
import { Adal5HTTPService, Adal5Service } from 'adal-angular5';
...
export class HttpService {
    constructor(
        private adal5HttpService: Adal5HTTPService,
        private adal5Service: Adal5Service) { }

public get(url: string): Observable<any> {
        const options = this.prepareOptions();
        return this.adal5HttpService.get(url, options)
    }
    
private prepareOptions():any{
 let headers = new HttpHeaders();
        headers = headers
            .set('Content-Type', 'application/json')
            .set('Authorization', `Bearer ${this.adal5Service.userInfo.token}`);
        return { headers };
}
```

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