# bell-legacy

> Third-party login plugin for hapi

Latest version **8.2.1** (published 2019-10-03) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install bell-legacy
pnpm add bell-legacy
yarn add bell-legacy
bun add bell-legacy
```

## Health

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

Positive: no vulnerabilities; high maintenance score.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 8.2.1 |
| Published | 2019-10-03 |
| First published | 2019-10-03 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 5 |
| Unpacked size | 58.8 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 615 |
| Maintainers | ubaltaci |
| Keywords | hapi, login, authentication, oauth, plugin, auth0, arcgisonline, bitbucket, dropbox, facebook, fitbit, foursquare, github, gitlab, google, instagram, linkedin, live, meetup, nest, phabricator, office365, reddit, tumblr, twitter, vk, wordpress, yahoo |

## Links

- npm: https://www.npmjs.com/package/bell-legacy
- Repository: https://github.com/hapijs/bell
- Homepage: https://github.com/hapijs/bell#readme
- Issues: https://github.com/hapijs/bell/issues
- npm.io page: https://npm.io/package/bell-legacy

## Dependencies (5)

- [joi](https://npm.io/package/joi.md) 9.x.x
- [boom](https://npm.io/package/boom.md) 4.x.x
- [hoek](https://npm.io/package/hoek.md) 4.x.x
- [wreck](https://npm.io/package/wreck.md) 9.x.x
- [cryptiles](https://npm.io/package/cryptiles.md) 3.x.x

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

- 8.2.1 (latest) — 2019-10-03

## README

# **bell**

Third-party authentication plugin for [hapi](https://github.com/hapijs/hapi).

Lead Maintainer: [Lois Desplat](https://github.com/ldesplat)

[![Build Status](https://secure.travis-ci.org/hapijs/bell.png)](http://travis-ci.org/hapijs/bell)

**bell** ships with built-in support for authentication using `Facebook`, `GitHub`, `Google`, `Google Plus`, `Instagram`, `LinkedIn`, `Slack`, `Twitter`, `Yahoo`, `Foursquare`, `VK`, `ArcGIS Online`, `Windows Live`, `Nest`, `Phabricator`, `BitBucket`, `Dropbox`, `Reddit`, `Tumblr`, `Twitch`, `Salesforce`, `Pinterest` and `Discord`. It also supports any compliant `OAuth 1.0a` and `OAuth 2.0` based login services with a simple configuration object.

## Documentation

[**API Documentation**](API.md)

[**Providers Documentation**](Providers.md)

## Tutorials

[**Social Login with Twitter using hapi.js**](http://mph-web.de/social-signup-with-twitter-using-hapi-js/)

## Example

```javascript
var Hapi = require('hapi');
var server = new Hapi.Server();

server.connection({ port: 8000 });

// Register bell with the server
server.register(require('bell'), function (err) {

    // Declare an authentication strategy using the bell scheme
    // with the name of the provider, cookie encryption password,
    // and the OAuth client credentials.
    server.auth.strategy('twitter', 'bell', {
        provider: 'twitter',
        password: 'cookie_encryption_password_secure',
        clientId: 'my_twitter_client_id',
        clientSecret: 'my_twitter_client_secret',
        isSecure: false     // Terrible idea but required if not using HTTPS especially if developing locally
    });

    // Use the 'twitter' authentication strategy to protect the
    // endpoint handling the incoming authentication credentials.
    // This endpoints usually looks up the third party account in
    // the database and sets some application state (cookie) with
    // the local application account information.
    server.route({
        method: ['GET', 'POST'], // Must handle both GET and POST
        path: '/login',          // The callback endpoint registered with the provider
        config: {
            auth: 'twitter',
            handler: function (request, reply) {

                if (!request.auth.isAuthenticated) {
                    return reply('Authentication failed due to: ' + request.auth.error.message);
                }

                // Perform any account lookup or registration, setup local session,
                // and redirect to the application. The third-party credentials are
                // stored in request.auth.credentials. Any query parameters from
                // the initial request are passed back via request.auth.credentials.query.
                return reply.redirect('/home');
            }
        }
    });

    server.start();
});
```

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