# byu-oauth

> Handles the OAuth2.0 flow for BYU APIs

Latest version **1.1.0** (published 2017-03-06) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install byu-oauth
pnpm add byu-oauth
yarn add byu-oauth
bun add byu-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.1.0 |
| Published | 2017-03-06 |
| First published | 2017-01-09 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Brett Beatty |
| Maintainers | byu-oit |
| Keywords | byu, oauth |

## Links

- npm: https://www.npmjs.com/package/byu-oauth
- Repository: https://github.com/byu-oit-appdev/byu-oauth
- Homepage: https://github.com/byu-oit-appdev/byu-oauth#readme
- Issues: https://github.com/byu-oit-appdev/byu-oauth/issues
- npm.io page: https://npm.io/package/byu-oauth

## 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

- 1.1.0 (latest) — 2017-03-06
- 1.0.1 — 2017-01-09

## README

# byu-oauth
Handles the OAuth2.0 flow for BYU APIs

## Examples
```JavaScript
var OAuth = require("byu-oauth");

OAuth.getAccessToken(OAuth.grant_type.AUTHORIZATION_CODE, {
  client_id: /*client id*/,
  client_secret: /*client secret*/,
  code: /*authorization code*/,
  redirect_uri: /*redirect uri--where WSO2 redirected user after user validated your app*/
}).then(function (token) {
  
  //  use token here
  console.log(token);

}).catch(function (err) {
  
  //  handle error here
  console.error(err);
});

OAuth.getAccessToken(OAuth.grant_type.CLIENT_CREDENTIALS, {
  client_id: /*client id*/,
  client_secret: /*client secret*/
}).then(function (token) {
  
  //  use token here
  console.log(token);

}).catch(function (err) {
  
  //  handle error here
  console.error(err);
});

OAuth.getAccessToken(OAuth.grant_type.REFRESH_TOKEN, {
  client_id: /*client id*/,
  client_secret: /*client secret*/
  refresh_token: /*refresh token*/
}).then(function (token) {
  
  //  use token here
  console.log(token);

}).catch(function (err) {
  
  //  handle error here
  console.error(err);
});

OAuth.getAccessToken(OAuth.grant_type.RESOURCE_OWNER, {
  client_id: /*client id*/,
  client_secret: /*client secret*/,
  password: /*password for NetID*/,
  username: /*NetID*/
}).then(function (token) {
  
  //  use token here
  console.log(token);

}).catch(function (err) {
  
  //  handle error here
  console.error(err);
});

OAuth.generateAuthorizationURL(OAuth.grant_type.AUTHORIZATION_CODE, /*client id*/, /*redirect uri*/)
.then(function (authorization_url) {
  
  //  use authorization URL here
  console.log(authorization_url);

}).catch(function (err) {
  
  //  handle error here
  console.error(err);
});

OAuth.generateAuthorizationURL(OAuth.grant_type.IMPLICIT, /*client id*/, /*redirect uri*/)
.then(function (authorization_url) {
  
  //  use authorization URL here
  console.log(authorization_url);

}).catch(function (err) {
  
  //  handle error here
  console.error(err);
});

```

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