# oauth2-auth-code-pkce

> An OAuth 2.0 client that ONLY supports Authorization Code flow with PKCE support.

Latest version **0.1.1** (published 2019-10-17) · AGPL-3.0-only license · 0 weekly downloads

## Install

```sh
npm install oauth2-auth-code-pkce
pnpm add oauth2-auth-code-pkce
yarn add oauth2-auth-code-pkce
bun add oauth2-auth-code-pkce
```

## 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.1 |
| Published | 2019-10-17 |
| First published | 2019-10-17 |
| Weekly downloads | 0 |
| License | AGPL-3.0-only |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 64.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Lee Fallat |
| Maintainers | lf94 |
| Keywords | oauth, oauth2, pkce |

## Links

- npm: https://www.npmjs.com/package/oauth2-auth-code-pkce
- npm.io page: https://npm.io/package/oauth2-auth-code-pkce

## 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.1 (latest) — 2019-10-17
- 0.1.0 — 2019-10-17

## README

# OAuth2AuthCodePKCE client

## Installation

`npm install @bity/oauth2-auth-code-pkce`

## Usage

### JavaScript example

```html
<script type="module" src="node_modules/@bity/oauth2-auth-code-pkce/index.mjs"></script>
<script>
OAuth2AuthCodePKCE
  .isComingBackFromAuthServer()
  .then((oauth) => oauth.getAccessToken())
  .then((token) => console.log(token))
  .catch((potentialError) => {
    if (potentialError) {
      alert(potentialError);
      return;
    }

    (new OAuth2AuthCodePKCE())
      .setConfig({
        authorizationUrl: 'https://localhost:8000/oauth2/auth',
        tokenUrl: 'https://localhost:8000/oauth2/token',
        clientId: 'f1e4ee59-d775-4314-b8bc-25e80c0b1ede',
        endpoints: ['http://localhost:4445'],
        scopes: ['offline'],
        redirectUrl: 'http://localhost:8080'
      })
      .fetchAuthorizationGrant();
  });
```

### TypeScript example

```typescript
import { OAuth2AuthCodePKCE, Token } from './index';

OAuth2AuthCodePKCE
  .isComingBackFromAuthServer()
  .then((oauth: OAuth2AuthCodePKCE) => oauth.getAccessToken())
  .then((token: Token | undefined) => console.log(token))
  .catch((potentialError: string) => {
    if (potentialError) {
      alert(potentialError);
      return;
    }

    (new OAuth2AuthCodePKCE())
      .setConfig({
        authorizationUrl: 'https://localhost:8000/oauth2/auth',
        tokenUrl: 'https://localhost:8000/oauth2/token',
        clientId: 'f1e4ee59-d775-4314-b8bc-25e80c0b1ede',
        endpoints: ['http://localhost:4445'],
        scopes: ['offline'],
        redirectUrl: 'http://localhost:8080'
      })
      .fetchAuthorizationGrant();
  });
```

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