# oauth2-server-grant-type-facebook

> Facebook grant type for @node-oauth/oauth2-server

Latest version **0.4.0** (published 2026-05-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install oauth2-server-grant-type-facebook
pnpm add oauth2-server-grant-type-facebook
yarn add oauth2-server-grant-type-facebook
bun add oauth2-server-grant-type-facebook
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2026-05-16 |
| First published | 2020-09-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20 |
| Dependencies | 0 |
| Unpacked size | 21.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3 |
| Author | Justas Palumickas |
| Maintainers | jpalumickas |
| Keywords | oauth, oauth2, oauth2-server, grant-type, facebook |

## Links

- npm: https://www.npmjs.com/package/oauth2-server-grant-type-facebook
- Repository: https://github.com/jpalumickas/node-oauth2-server-grant-type-facebook
- Homepage: https://github.com/jpalumickas/node-oauth2-server-grant-type-facebook#readme
- Issues: https://github.com/jpalumickas/node-oauth2-server-grant-type-facebook/issues
- npm.io page: https://npm.io/package/oauth2-server-grant-type-facebook

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@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

## Recent versions

- 0.4.0 (latest) — 2026-05-16
- 0.3.0 — 2022-06-29
- 0.2.2 — 2021-04-10
- 0.2.1 — 2021-01-16
- 0.2.0 — 2020-09-20
- 0.1.0 — 2020-09-18

## README

# OAuth2 Server Facebook Grant Type

Adds Facebook grant type for [@node-oauth/oauth2-server][oauth2-server]

## Installation

Using pnpm

```sh
pnpm add oauth2-server-grant-type-facebook
```

Using npm

```sh
npm install oauth2-server-grant-type-facebook
```

## Usage

Add `getUserWithFacebook` to [@node-oauth/oauth2-server][oauth2-server] model.

```js
  const getUserWithFacebook = async (facebookData) => {
    // Find and return user by Facebook ID

    // Find and return user by Facebook email

    // If not exists create new user
  };
```

Add Facebook grant type to `extendedGrantTypes` in [@node-oauth/oauth2-server][oauth2-server] options:

```js
  import { FacebookGrantType } from 'oauth2-server-grant-type-facebook';

  const options = {
    model: ...,
    extendedGrantTypes: {
      facebook: FacebookGrantType,
    },
    requireClientAuthentication: {
      facebook: false,
    },
  }
```

You can customize what fields to return from Facebook by providing `facebookGrantType` options in model:

```js
const options = {
  model: {
    ...model,
    facebookGrantType: {
      fields: ['email', 'first_name', 'last_name', 'picture.width(500).height(500)'], // Default: email, first_name, last_name
    },
  },
  extendedGrantTypes,
}
```

Post request to `/oauth/token` with `facebook` grant type:

```json
{
  "grant_type": "facebook",
  "client_id": "YOUR_CLIENT_ID",
  "facebook_token": "FACEBOOK_TOKEN"
}
```

## License

The package is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

[oauth2-server]: https://github.com/node-oauth/node-oauth2-server

---
_Source: https://npm.io/package/oauth2-server-grant-type-facebook · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
