# @bandwidth/mfa

> Bandwidth's Two-Factor Authentication service

Latest version **3.0.12** (published 2024-08-20) · MIT license · 0 weekly downloads

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

## Install

```sh
npm install @bandwidth/mfa
pnpm add @bandwidth/mfa
yarn add @bandwidth/mfa
bun add @bandwidth/mfa
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.12 |
| Published | 2024-08-20 |
| First published | 2020-05-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 7 |
| Unpacked size | 467.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | APIMATIC SDK Generator |
| Maintainers | jmulford-bandwidth, tbowen, zelitzsi, themikez, nguyer, developerhelp-bandwidth, cejohnson-bw, mhamer-bw |

## Links

- npm: https://www.npmjs.com/package/@bandwidth/mfa
- npm.io page: https://npm.io/package/@bandwidth/mfa

## Dependencies (7)

- [axios](https://npm.io/package/axios.md) ^1.7.4
- [form-data](https://npm.io/package/form-data.md) ^3.0.0
- [@types/node](https://npm.io/package/@types/node.md) ^14.14.27
- [detect-node](https://npm.io/package/detect-node.md) ^2.0.4
- [tiny-warning](https://npm.io/package/tiny-warning.md) ^1.0.3
- [lodash.flatmap](https://npm.io/package/lodash.flatmap.md) ^4.5.0
- [@apimatic/schema](https://npm.io/package/@apimatic/schema.md) ^0.6.0

## Recent versions

- 3.0.12 (latest) — 2024-08-20
- 3.0.11 — 2024-03-19
- 3.0.10 — 2024-01-16
- 3.0.9 — 2024-01-02
- 3.0.8 — 2023-11-07
- 3.0.7 — 2023-10-17
- 3.0.6 — 2023-08-30
- 3.0.5 — 2023-03-28
- 3.0.4 — 2022-08-02
- 3.0.3 — 2022-03-29
- 3.0.2 — 2022-01-18
- 3.0.1 — 2021-09-28
- 3.0.0 — 2021-04-13
- 2.0.0 — 2021-01-06
- 1.1.1 — 2020-06-30
- … 3 more at https://npm.io/package/@bandwidth/mfa/versions

## README

# Bandwidth Node Multi-Factor Authentication SDK

Note: As of version 3.0.0, this package has been upgraded to TypeScript

[![Test](https://github.com/Bandwidth/node-mfa/actions/workflows/test.yml/badge.svg)](https://github.com/Bandwidth/node-mfa/actions/workflows/test.yml)

| **OS** | **Node** |
|:---:|:---:|
| Windows 2016 | 12, 14, 16 |
| Windows 2019 | 12, 14, 16 |
| Ubuntu 20.04 | 12, 14, 16 |
| Ubuntu 22.04 | 12, 14, 16 |

## Getting Started

### Installation

```
npm install @bandwidth/mfa
```

### Initialize

```
import { Client, MFAController } from '@bandwidth/mfa';

const client = new Client({
    basicAuthUserName: "username",
    basicAuthPassword: "password"
});

const controller = new MFAController(client);
const accountId = "12345";
```

### Create A MFA Request

```
var from = "+15554443333";
var to = "+15553334444";
var applicationId = "3-a-b-c";
var scope = "scope";
var digits = 6;
var message = "Your temporary {NAME} {SCOPE} code is {CODE}";

var requestBody = {
    from: from,
    to: to,
    applicationId: applicationId,
    scope: scope,
    digits: digits,
    message: message
};

await controller.voiceTwoFactor(accountId, requestBody);

//request verification
const code = '123456'; //this is the user input to validate
const expirationTimeInMinutes = 3

var verifyBody = {
    to: to,
    applicationId: applicationId,
    scope: scope,
    code: code,
    expirationTimeInMinutes: expirationTimeInMinutes
}

var verifyMfaResponse = await controller.verifyTwoFactor(accountId, verifyBody);

console.log(verifyMfaResponse.result.valid);
```

## Supported Node Versions

This package can be used with Node >= 10

## Documentation

Documentation for this package can be found at https://dev.bandwidth.com/sdks/node.html

## Credentials

Information for credentials for this package can be found at https://dev.bandwidth.com/guides/accountCredentials.html

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