# @lighthouseapps/oauth2-client

> > Javascript oauth2 client

Latest version **1.0.10** (published 2022-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @lighthouseapps/oauth2-client
pnpm add @lighthouseapps/oauth2-client
yarn add @lighthouseapps/oauth2-client
bun add @lighthouseapps/oauth2-client
```

## 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.10 |
| Published | 2022-02-10 |
| First published | 2019-09-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alvaro Silveira |
| Maintainers | leosampc, marlonconstante, gustavo-kuze, donnes, alvarosilveiraa, lhdev |

## Links

- npm: https://www.npmjs.com/package/@lighthouseapps/oauth2-client
- npm.io page: https://npm.io/package/@lighthouseapps/oauth2-client

## Recent versions

- 1.0.10 (latest) — 2022-02-10
- 1.0.9 — 2021-12-30
- 1.0.8 — 2021-12-30
- 1.0.7 — 2020-07-30
- 1.0.6 — 2020-02-18
- 1.0.5 — 2019-11-07
- 1.0.4 — 2019-10-31
- 1.0.3 — 2019-10-01
- 1.0.2 — 2019-09-30

## README

# oauth2-client
> Javascript oauth2 client

### Usage
```Javascript
import OAuth2Client from './lib/OAuth2Client';
import AsyncStorage from '@react-native-community/async-storage';

class ReactNativeOAuth2Model {
  constructor(navigation) {
    this.navigation = navigation;
  }

  createCode() {}

  createCodeToken() {}

  createPasswordToken() {}

  refreshToken() {}

  signout() {}
}

class ReactNativeOAuth2 {
  initialize(model, options = {}) {
    this.client = new OAuth2Client(model, {
      ...options,
      Storage: AsyncStorage
    });
  }

  getToken() {
    return this.client.getToken();
  }

  signinWithPassword() {
    return this.client.signinWithPassword(...arguments);
  }

  signinWithAuthorizationCode() {
    return this.client.signinWithAuthorizationCode(...arguments);
  }

  signout() {
    return this.client.signout();
  }
}

class WebOAuth2 {
  initialize(model, options = {}) {
    this.client = new OAuth2Client(model, {
      ...options,
      Storage: localStorage
    });
  }

  getToken() {
    return this.client.getToken();
  }

  signinWithPassword() {
    return this.client.signinWithPassword(...arguments);
  }

  signinWithAuthorizationCode() {
    return this.client.signinWithAuthorizationCode(...arguments);
  }

  signout() {
    return this.client.signout();
  }
}

const oauth2 = new ReactNativeOAuth2();

oauth2.initialize(new ReactNativeOAuth2Model(this.props.navigation));
```

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