# @bmat/angular-authentication

> This Angular module configures an AuthService that will take care of:

Latest version **8.2.1** (published 2019-09-03) · 0 weekly downloads

## Install

```sh
npm install @bmat/angular-authentication
pnpm add @bmat/angular-authentication
yarn add @bmat/angular-authentication
bun add @bmat/angular-authentication
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 8.2.1 |
| Published | 2019-09-03 |
| First published | 2018-02-02 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 369.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dogmatico |

## Links

- npm: https://www.npmjs.com/package/@bmat/angular-authentication
- npm.io page: https://npm.io/package/@bmat/angular-authentication

## Dependencies (1)

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

## Recent versions

- 8.2.1 (latest) — 2019-09-03
- 8.0.2-rc.1 (next) — 2019-07-03
- 8.2.0 — 2019-08-06
- 8.0.1 — 2019-06-18
- 8.0.0 — 2019-06-17
- 7.1.0-beta.3 — 2018-12-14
- 7.0.1 — 2018-10-30
- 7.0.0 — 2018-10-24
- 6.1.0-alpha.11 — 2018-09-28
- 6.1.0-alpha.10 — 2018-09-28
- 6.1.0-alpha.9 — 2018-09-27
- 6.1.0-alpha.8 — 2018-09-25
- 6.1.0-alpha.6 — 2018-07-16
- 6.1.0-alpha.4 — 2018-06-28
- 6.1.0-alpha.3 — 2018-06-28
- … 3 more at https://npm.io/package/@bmat/angular-authentication/versions

## README

# `@bmat/angular-authentication`

This Angular module configures an AuthService that will take care of:

- Parsing callbacks,
- Requesting SSO authentications,
- Polling session data, both to invalidae and renew sessions.

## Usage

To enable authentication in the SPA, you need to import the module,

```TypeScript
    @NgModule({
        imports: [
            ...other imports,
            AuthenticationModule.forRoot({
                tokenGetter,
                webCustomData: Auth0LockOptions,
                authOptions: WebAuthOptions,
            }),
        ],
        ...
    })
    export AppModule {}
```

If you need to call an API with the token, you need to add the interceptors
with the same tokenGetter function. The recommended way is to use the dependency
`@auth0/angular-jwt`:

```TypeScript
    @NgModule({
        imports: [
            ...other imports,
            JwtModule.forRoot({
                config: {
                    tokenGetter,
                    whitelistedDomains: [
                    new RegExp('bmat.com'),
                    new RegExp('localhost'),
                    new RegExp('^null$'),
                    ],
                },
            }),
        ],
        ...
    })
    export AppModule {}
```

Import the `JwtModule` after `AuthenticationModule` if you require additional options.

## Guards

The module exports `AuthenticatedGuard`. If the user is not logged when accessing a guarded route, it will call
the logout functions.

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