# @indec/heimdall

> ## Installation

Latest version **0.2.9** (published 2024-02-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @indec/heimdall
pnpm add @indec/heimdall
yarn add @indec/heimdall
bun add @indec/heimdall
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.9 |
| Published | 2024-02-08 |
| First published | 2017-09-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.13 |
| Dependencies | 0 |
| Unpacked size | 20.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | INDEC |
| Maintainers | dmiglierini, mforlenza |

## Links

- npm: https://www.npmjs.com/package/@indec/heimdall
- npm.io page: https://npm.io/package/@indec/heimdall

## Recent versions

- 0.2.9 (latest) — 2024-02-08
- 0.2.8-next.0 (next) — 2018-09-29
- 0.2.7-next.0 (next-0.2) — 2018-07-03
- 0.0.1-beta.9 (zero-beta) — 2018-03-05
- 0.2.8 — 2018-11-26
- 0.2.8-next.1 — 2018-11-25
- 0.2.7 — 2018-09-12
- 0.2.6 — 2018-05-07
- 0.2.5 — 2018-03-05
- 0.2.4 — 2018-03-05
- 0.0.1-beta.8 — 2017-12-06
- 0.2.3 — 2017-11-20
- 0.2.2 — 2017-11-05
- 0.2.1 — 2017-11-05
- 0.2.0 — 2017-11-04
- … 9 more at https://npm.io/package/@indec/heimdall/versions

## README

# Heimdall

## Installation

    npm install @indec/heimdall

## Configuration

Add the following environment variables:
    
```bash
AUTH_ENDPOINT=http://localhost:5000
AUTH_CLIENT_ID=<your app client_id>
AUTH_CLIENT_SECRET=<your app secret>
GRANT_TYPE=client_credentials
```

## Examples

### Login on client side

```js
import {LoginService} from '@indec/heimdall/client';

// ENDPOINT constant is your heimdall server. i.e: http://localhost:5000
const loginService = new LoginService(ENDPOINT);
const token = await loginService.login(username, password);
```

### Clean user session

```js
import {TokenService} from '@indec/heimdall/client';

TokenService.clear();
```


### Listing users
List your app's users on server side:

```js
const {UserService} = require('@indec/heimdall').services;

try {
    const users = await UserService.fetchAll();
    console.log(users);
} catch (err) {
    console.error(err);
}
```

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