# google_authenticator

> GoogleAuthenticator

Latest version **2.0.1** (published 2021-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install google_authenticator
pnpm add google_authenticator
yarn add google_authenticator
bun add google_authenticator
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2021-08-22 |
| First published | 2016-08-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | luojia@luojia.me |
| Maintainers | luojia |
| Keywords | GoogleAuthenticator |

## Links

- npm: https://www.npmjs.com/package/google_authenticator
- Repository: https://github.com/JiaJiaJiang/nodejs-GoogleAuthenticator
- Issues: https://github.com/JiaJiaJiang/nodejs-GoogleAuthenticator/issues
- npm.io page: https://npm.io/package/google_authenticator

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2021-08-22
- 2.0.0 — 2019-07-23
- 1.0.8 — 2019-01-29
- 1.0.7 — 2019-01-29
- 1.0.6 — 2017-04-21
- 1.0.5 — 2016-08-17
- 1.0.4 — 2016-08-16
- 1.0.3 — 2016-08-16
- 1.0.2 — 2016-08-16
- 1.0.1 — 2016-08-16
- 1.0.0 — 2016-08-16

## README

# nodejs-GoogleAuthenticator

![nodejs-GoogleAuthenticator-logo](https://jiajiajiang.github.io/staticRepo/nodejs-GoogleAuthenticator/logo.png)

## Installation

``````
npm i google_authenticator --save
``````

## Usage

``````
var googleAuth=require('google_authenticator').authenticator;
var nya=new googleAuth();
``````

# API
## Class:    googleAuth([codeLength=6])
The main class.

 - codeLength:optional,the length of the verifiction code,defaults to 6.



## googleAuth.createSecret([secretLength=16])
To create a random secret string.
> return the secret string.

 - secretLength:optional,the length of the secret string,defaults to 16。




## googleAuth.getCode(secret[,timeSlice])
get the code
> return a string of code consists by numbers.

 - secret:the secret string.
 - timeSlice:optional,specifies the time slice.



## googleAuth.verifyCode(secret,code[,discrepancy=1,currentTimeSlice])
verify the code.
> if verified,return true,otherwise return false.

 - secret:the secret string.
 - code:the verifiction code.
 - discrepancy:the allowed time discrepancy.
 - currentTimeSlice:you know.


## googleAuth.getQRCodeText(name,secret[,title])
get the QR code raw text

 - name:the name to display in the GoogleAuthenticator client.
 - secret:the secret string.
 - title:optional,I can't find if this is displayed anywhere.....

## googleAuth.getGoogleQRCodeAPIUrl(name,secret[,title])
get the QR code image using google api.
> return the url of the QR image.

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