# get-twitter-bearer-token

> Get twitter bearer_token for oAuth

Latest version **1.0.0** (published 2017-02-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-twitter-bearer-token
pnpm add get-twitter-bearer-token
yarn add get-twitter-bearer-token
bun add get-twitter-bearer-token
```

## 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 | 1.0.0 |
| Published | 2017-02-26 |
| First published | 2017-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | wellsjo |
| Maintainers | wellsjo |

## Links

- npm: https://www.npmjs.com/package/get-twitter-bearer-token
- Repository: https://github.com/wellsjo/get-twitter-bearer-token
- Homepage: https://github.com/wellsjo/get-twitter-bearer-token#readme
- Issues: https://github.com/wellsjo/get-twitter-bearer-token/issues
- npm.io page: https://npm.io/package/get-twitter-bearer-token

## Dependencies (1)

- [superagent](https://npm.io/package/superagent.md) ^3.5.0

## Recent versions

- 1.0.0 (latest) — 2017-02-26

## README

# get-twitter-bearer-token
This is a convenience method to obtain an application bearer token for the Twitter api. It sends a request to `/oauth2/token` endpoint with the correctly formatted credentials (base64 encoded consumer key and secret) and headers.

This is only meant to be used once per application/token, since the token needs to be explicitly invalidated to stop working. 

## Install
```
npm i
```

## Usage
```javascript
const getBearerToken = require('get-twitter-bearer-token')

const twitter_consumer_key = 'your-consumer-key'
const twitter_consumer_secret = 'your-consumer-secret'

getBearerToken(twitter_consumer_key, twitter_consumer_secret, (err, res) => {
  if (err) {
    // handle error
  } else {
  
    // bearer token
    console.log(res.body.access_token)
  }
})
```

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