# autwh

> Twitter oAuth Helper

Latest version **0.1.0** (published 2018-04-09) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-04-09 |
| First published | 2017-01-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | syuilo |
| Maintainers | syuilo |
| Keywords | twitter, oauth |

## Links

- npm: https://www.npmjs.com/package/autwh
- Repository: https://github.com/syuilo/autwh
- Homepage: https://github.com/syuilo/autwh#readme
- Issues: https://github.com/syuilo/autwh/issues
- npm.io page: https://npm.io/package/autwh

## Dependencies (1)

- [oauth](https://npm.io/package/oauth.md) 0.9.15

## Alternatives

- [@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
- [escher-request](https://npm.io/package/escher-request.md) — 545 weekly downloads

## Recent versions

- 0.1.0 (latest) — 2018-04-09
- 0.0.1 — 2017-01-21
- 0.0.0 — 2017-01-21

## README

autwh
-------------------------------

[![][npm-badge]][npm-link]
[![][mit-badge]][mit]

> A simple Twitter API authentication helper.

[![NPM](https://nodei.co/npm/autwh.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/autwh)

## Install
``` shell
$ npm install autwh
```

## Usage
### With [Express](https://github.com/expressjs/express)

In this example, express-session is used, but **other methods are also possible.**

``` javascript
import autwh from 'autwh';
import * as express from 'express';
import * as session from 'express-session';

const twAuth = autwh({
	consumerKey: 'kyoppie',
	consumerSecret: 'yuppie',
	callbackUrl: 'https://my.app.example.com/twitter/callback'
});

const app = express();
app.use(session());

app.get('/twitter/connect', async (req, res) => {
	const ctx = await twAuth.begin();
	req.session.ctx = ctx;
	res.redirect(ctx.url);
});

// URL used in 'callbackUrl' above
app.get('/twitter/callback', async (req, res) => {
	const ctx = await twAuth.done(req.session.ctx, req.query.oauth_verifier);
	res.send(`Authorized! Hello ${ctx.screenName}.`);
});
```

## License
[MIT](LICENSE)

[npm-link]:  https://www.npmjs.com/package/autwh
[npm-badge]: https://img.shields.io/npm/v/autwh.svg?style=flat-square
[mit]:       http://opensource.org/licenses/MIT
[mit-badge]: https://img.shields.io/badge/license-MIT-444444.svg?style=flat-square

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