# sling-auth

> Sling AWS STS authentication module

Latest version **1.1.6** (published 2019-03-06) · ISC license · 0 weekly downloads

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

## Install

```sh
npm install sling-auth
pnpm add sling-auth
yarn add sling-auth
bun add sling-auth
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2019-03-06 |
| First published | 2019-03-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 14.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | BBC |
| Maintainers | tarqwyn |

## Links

- npm: https://www.npmjs.com/package/sling-auth
- Repository: https://github.com/bbc/sling-auth
- Homepage: https://github.com/bbc/sling-auth#readme
- Issues: https://github.com/bbc/sling-auth/issues
- npm.io page: https://npm.io/package/sling-auth

## Dependencies (1)

- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.49.0

## Recent versions

- 1.1.6 (latest) — 2019-03-06

## README

# Sling Authentication
> Sling AWS STS authentication module

This module is used to turn credentials from the news AWS root account (311417952909) into usable credentials for a sling role.

## Examples

Below examples of Sling Authentication API:

### Get roles shortnames (#SlingAuth.getRoleShortnames({environment: 'environment'}))
This method returns an array of valid role shortnames for a environment. The shortname is required by other methods.

**Example:**

```
const SlingAuth = require('sling-auth');
SlingAuth.getRoleShortnames({environment: 'live'}); // Static method (SlingAuth isn't initalised)
```

**Output:**

```
=> ['neareast', 'news', 'southasia']
```

### Get role credentials (#getRoleCredentials(options))
This method returns a Promise which is resolved with the role credentials. These credentials can then be used with Sling to upload, modify and delete files from S3, in locations that the role is permitted.

**Example:**

```
const SlingAuth = require('sling-auth');
const slingAuth = new SlingAuth();

const roleOptions = {
    environment: 'live',
    roleShortname: 'news',
    accessKeyId: 'AAAAAAA000AA111AAA',
    secretAccessKey: 'XxX3XXasdDss12/zzZzzZz1aaAaaaAAa'
};
slingAuth.getRoleCredentials().then((credentials) => {
    console.log(credentials);
}).catch((error) => {
    console.log(`Error: ${error}`);
});
```

**Output:**

```
{
	'AccessKeyId': 'roleKey',
	'SecretAccessKey': 'roleSecret',
	'SessionToken': 'roleSession',
	'Expiration': '2020-01-01T00:00:00.000Z'
}
```

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