# derby-user-providers

> Add third party provider support to derby-user

Latest version **0.7.0** (published 2014-09-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install derby-user-providers
pnpm add derby-user-providers
yarn add derby-user-providers
bun add derby-user-providers
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.0 |
| Published | 2014-09-21 |
| First published | 2013-07-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+6 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | psirenny |
| Maintainers | psirenny |
| Keywords | authentication, derby, facebook, google, node, passport, providers, strategy, twitter, user |

## Links

- npm: https://www.npmjs.com/package/derby-user-providers
- Repository: https://github.com/psirenny/derby-user-providers
- Issues: https://github.com/psirenny/derby-user-providers/issues
- npm.io page: https://npm.io/package/derby-user-providers

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^2.4.1
- [express](https://npm.io/package/express.md) ^4.9.4
- [passport](https://npm.io/package/passport.md) ^0.2.1

## 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.7.0 (latest) — 2014-09-21
- 0.6.1 — 2014-09-21
- 0.6.0 — 2014-09-21
- 0.5.0 — 2014-05-23
- 0.4.1 — 2014-05-06
- 0.4.0 — 2014-01-27
- 0.3.0 — 2013-11-18
- 0.2.0 — 2013-09-24
- 0.1.1 — 2013-08-07
- 0.1.0 — 2013-08-05
- 0.0.1 — 2013-07-31
- 0.0.0 — 2013-07-29

## README

Derby User Providers
====================

Add 3rd party providers to [derby-user](https://github.com/psirenny/derby-user) such as facebook google, twitter, etc…

Installation
------------

    $ npm install derby-user-providers --save

Usage
-----

In your server file, add the middleware:

    var providers = require('derby-user-providers');

    var google = {
      config: {
        clientID: '...',
        clientSecret: '...',
        strategy: {
          module: 'passport-google-oauth',
          name: 'OAuth2Strategy'
        }
      }
    };

    var facebook = {
      config: {
        clientID: '...',
        clientSecret: '...',
        authOptions: {scope: ['email']},
        strategy: require('passport-facebook')
      }
    };

    expressApp
      // ...
      // ...
      // cookieParser, session, transport, model, bodyParser...
      .use(user.init())
      // ...
      // ...
      .use('/user', providers({
        origin: 'http://localhost',
        path: '/user',
        providers: {facebook: facebook, google: google}
      }))

Visit */user/auth/facebook*.

Routes
------

**/auth/:provider?params** – Call this route to authenticate a user. The params are merged into *authOptions*.

**/auth/:provider/done** – This route is called when authentication is done. Can be overriden. Redirects to */* by default.

Options
-------

**origin** – **Required**. The site origin providers will redirect back to upon sign in.

**emitter** – Specify an event emitter that will handle events.

**path** – Must be set if you use an express path prefix. (See above)

**providers** – An object containing providers and their configuration settings.

Providers
---------

**config** – Configuration options for the strategy. Refer to the passport strategy's docs.

**strategy** – The passport strategy function or an object with the strategy name and/or module.

**authOptions** – Passport authenticate options passed in during verification. Used to pass in scope, etc.

**callbackOptions** – Passport authenticate options passed in during the callback.

Events
------

**user.auth(req, data)** – Event emitted when a new user authenticates. Contains **userId** and **provider** name.

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