# @lcrespilho/oauth2-authenticator

> Autenticador e autorizador oauth2

Latest version **3.2.0** (published 2022-05-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install @lcrespilho/oauth2-authenticator
pnpm add @lcrespilho/oauth2-authenticator
yarn add @lcrespilho/oauth2-authenticator
bun add @lcrespilho/oauth2-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 | 3.2.0 |
| Published | 2022-05-23 |
| First published | 2019-08-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Leonardo Lourenço Crespilho |
| Maintainers | lcrespilho |

## Links

- npm: https://www.npmjs.com/package/@lcrespilho/oauth2-authenticator
- npm.io page: https://npm.io/package/@lcrespilho/oauth2-authenticator

## Dependencies (4)

- [url](https://npm.io/package/url.md) ^0.11.0
- [http](https://npm.io/package/http.md) 0.0.0
- [open](https://npm.io/package/open.md) ^8.4.0
- [server-destroy](https://npm.io/package/server-destroy.md) ^1.0.1

## Recent versions

- 3.2.0 (latest) — 2022-05-23
- 3.1.0 — 2022-05-23
- 3.0.0 — 2022-05-23
- 2.9.0 — 2019-09-03
- 2.8.0 — 2019-09-03
- 2.7.0 — 2019-09-03
- 2.6.0 — 2019-09-02
- 2.5.0 — 2019-09-02
- 2.4.0 — 2019-09-02
- 2.3.0 — 2019-09-02
- 2.2.0 — 2019-09-02
- 2.1.0 — 2019-09-02
- 2.0.0 — 2019-08-27
- 1.0.0 — 2019-08-27

## README

Facilitador para autenticação e autorização oauth2.

Uso:

```js
const { google } = require('googleapis');
const Authenticator = require('@lcrespilho/oauth2-authenticator');

// escolher os escopos da API que deseja trabalhar
const scopes = [
  'https://www.googleapis.com/...',
  'https://www.googleapis.com/...',
  'https://www.googleapis.com/...',
];

// Autentica e autoriza
new Authenticator(google, scopes, '/tmp/oauth2.keys.json' /*caminho absoluto*/).authenticate()

  // após autenticado/autorizado, executa o código que usa a API
  .then(async () => {
    const api = google.tagmanager('v2'); // exemplo para uso da API do tagmanager
    // ...
  })

  // captura de erros
  .catch(error => {
    console.error(error);
  });
```

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