# mediahead-token

> Token Generator and Verifier for Mediahead

Latest version **0.0.2** (published 2015-03-09) · All Rights Reserved license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install mediahead-token
pnpm add mediahead-token
yarn add mediahead-token
bun add mediahead-token
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2015-03-09 |
| First published | 2015-03-09 |
| Weekly downloads | 0 |
| License | All Rights Reserved |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| Author | Jonatan Männchen |
| Maintainers | maennchen |
| Keywords | token, mediahead, hash |

## Links

- npm: https://www.npmjs.com/package/mediahead-token
- Repository: https://github.com/Mediahead-AG/mediahead-token
- Issues: https://github.com/Mediahead-AG/mediahead-token/issues
- npm.io page: https://npm.io/package/mediahead-token

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) ^3.3.1

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2015-03-09
- 0.0.1 — 2015-03-09

## README

# Mediahead Token
[![npm version](https://badge.fury.io/js/mediahead-token.svg)](http://badge.fury.io/js/mediahead-token)
[![Code Climate](https://codeclimate.com/github/Mediahead-AG/mediahead-token/badges/gpa.svg)](https://codeclimate.com/github/Mediahead-AG/mediahead-token)
[![Test Coverage](https://codeclimate.com/github/Mediahead-AG/mediahead-token/badges/coverage.svg)](https://codeclimate.com/github/Mediahead-AG/mediahead-token)
[![Build Status](https://travis-ci.org/Mediahead-AG/mediahead-token.svg)](https://travis-ci.org/Mediahead-AG/mediahead-token)

Mediahead Token is meant to create Authorization between our own Applications.

With this Library we can generate a Token on Server 1 and verify it on Server 2.

## Configuration
There are three Environement Variables, which can be set:

 * `MEDIAHEAD_TOKEN_SECRET` - Set the Secret. It has to be the same on every Application, otherwise this won't validate.
 * `MEDIAHEAD_TOKEN_MAXAGE` - Set the Max Age of a Token in seconds. Defaults to 60 seconds.
 * `MEDIAHEAD_TOKEN_IDENTIFIER` - Default Identifier for Token generation.

## Instalation
### Install the Package
```bash
$ npm install git@bitbucket.org:mediahed/mediahead-token.git --save
```

### In your Code
```javascript
var token = require('mediahead-token');
```

## Usage

### Generate a new Token
```javascript
// If you don't have MEDIAHEAD_TOKEN_IDENTIFIER set
var generatedToken = token.createToken('identifier');
// else
var generatedToken = token.createToken();
```

### Validate a Token
```javascript
var tokenToValidate = new Token('$token$4123412$dfahdafhgdafg$');
var valid = tokenToValidate.validate();
```

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