# request-oauth

> OAuth 1.0a support for request-compose

Latest version **1.0.1** (published 2021-01-24) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install request-oauth
pnpm add request-oauth
yarn add request-oauth
bun add request-oauth
```

## 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.1 |
| Published | 2021-01-24 |
| First published | 2018-03-11 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 3 |
| Unpacked size | 16.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Simeon Velichkov |
| Maintainers | simov |
| Keywords | request, compose, http, oauth, client |

## Links

- npm: https://www.npmjs.com/package/request-oauth
- Repository: https://github.com/simov/request-oauth
- Issues: https://github.com/simov/request-oauth/issues
- npm.io page: https://npm.io/package/request-oauth

## Dependencies (3)

- [qs](https://npm.io/package/qs.md) ^6.9.6
- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [oauth-sign](https://npm.io/package/oauth-sign.md) ^0.9.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-01-24
- 1.0.0 — 2020-04-06
- 0.0.3 — 2018-05-02
- 0.0.2 — 2018-03-11
- 0.0.1 — 2018-03-11

## README

# request-oauth

[![npm-version]][npm] [![travis-ci]][travis] [![coveralls-status]][coveralls]

> _OAuth 1.0a support for **[request-compose]**_

```js
var request = require('request-compose').extend({
  Request: {oauth: require('request-oauth')}
}).client

;(async () => {
  try {
    var {res, body} = await request({
      url: 'https://api.twitter.com/1.1/users/show.json',
      qs: {
        screen_name: '[SCREEN NAME]'
      },
      oauth: {
        consumer_key: '[APP ID]',
        consumer_secret: '[APP SECRET]',
        token: '[ACCESS TOKEN]',
        token_secret: '[ACCESS SECRET]',
      }
    })
    console.log(body)
  }
  catch (err) {
    console.error(err)
  }
})()
```


# Options

| Option                 | Description
| :-                     | :-
| **Required**           |
| **`consumer_key`**     | OAuth application key
| **`consumer_secret`**  | OAuth application secret
| **`private_key`**      | in PEM format, set this key instead of `consumer_secret` when using `RSA-SHA1` signing
| **`token`**            | user's access token
| **`token_secret`**     | user's token secret
| **Defaults**           |
| **`version`**          | **`1.0`**
| **`signature_method`** | **`HMAC-SHA1`**, `RSA-SHA1`, `PLAINTEXT`
| **`transport_method`** | **`header`**, `query`, `form`
| **Generated**          |
| **`timestamp`**        |
| **`nonce`**            |
| **`signature`**        |
| **Optional**           |
| **`realm`**            |
| **`body_hash`**        | body hash string to use or `true` to get one generated for you


  [npm-version]: https://img.shields.io/npm/v/request-oauth.svg?style=flat-square (NPM Package Version)
  [travis-ci]: https://img.shields.io/travis/simov/request-oauth/master.svg?style=flat-square (Build Status - Travis CI)
  [coveralls-status]: https://img.shields.io/coveralls/simov/request-oauth.svg?style=flat-square (Test Coverage - Coveralls)

  [npm]: https://www.npmjs.com/package/request-oauth
  [travis]: https://travis-ci.org/simov/request-oauth
  [coveralls]: https://coveralls.io/github/simov/request-oauth

  [request-compose]: https://www.npmjs.com/package/request-compose
  [examples]: https://github.com/simov/request-compose#examples

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