<commit_before># Authentication Plugin
> Hapi auth plugin for the Screwdriver API

## Usage

### Register plugin

```javascript
const Hapi = require('hapi');
const server = new Hapi.Server();
const authPlugin = require('./');

server.connection({ port: 3000 });

server.register({
    register: authPlugin,
    options: {}
}, () => {
    server.start((err) => {
        if (err) {
            throw err;
        }
        console.log('Server running at:', server.info.uri);
    });
});
```

### Routes

#### Login

`GET /auth/login` or `POST /auth/login`

#### Get a token

`GET /auth/token`<commit_msg>docs(tokens): Document ability to call GET /auth/token with access key<commit_after># Authentication Plugin
> Hapi auth plugin for the Screwdriver API

## Usage

### Register plugin

```javascript
const Hapi = require('hapi');
const server = new Hapi.Server();
const authPlugin = require('./');

server.connection({ port: 3000 });

server.register({
    register: authPlugin,
    options: {}
}, () => {
    server.start((err) => {
        if (err) {
            throw err;
        }
        console.log('Server running at:', server.info.uri);
    });
});
```

### Routes

#### Login

`GET /auth/login` or `POST /auth/login`

#### Get a token

`GET /auth/token` (with OAuth) or `GET /auth/token?access_key=YOUR_ACCESS_KEY` (with API token)
{'fraction_non_alphanumeric': 0.17225950782997762, 'fraction_numerical': 0.005965697240865026, 'mean_word_length': 3.1677018633540373, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6575453', 'n_tokens_mistral': 438, 'n_tokens_neox': 420, 'n_words': 120}