bell
Third-party authentication plugin for hapi.
Lead Maintainer: Lois Desplat
bell ships with built-in support for authentication using Facebook
, GitHub
, Google
, Google Plus
, Instagram
, LinkedIn
, Slack
, Stripe
, Twitter
, Yahoo
, Foursquare
, VK
, ArcGIS Online
, Windows Live
, Nest
, Phabricator
, BitBucket
, Dropbox
, Reddit
, Tumblr
, Twitch
, Mixer
, Salesforce
, Pinterest
, Discord
, DigitalOcean
, AzureAD
, trakt.tv
and Okta
. It also supports any compliant OAuth 1.0a
and OAuth 2.0
based login services with a simple configuration object.
NOTE: Bell 8.x.y uses the Hapi v16 APIs and will not work with Hapi v17. As of writing, Bell 8.x.y is the latest version, and an effort to make Bell support Hapi v17 is underway.
Documentation
API Documentation
Providers Documentation
Tutorials
Social Login with Twitter using hapi.js
Examples
All Examples
Twitter:
var Hapi = require('hapi');
var server = new Hapi.Server();
server.connection({ port: 8000 });
server.register(require('bell'), function (err) {
server.auth.strategy('twitter', 'bell', {
provider: 'twitter',
password: 'cookie_encryption_password_secure',
clientId: 'my_twitter_client_id',
clientSecret: 'my_twitter_client_secret',
isSecure: false
});
server.route({
method: ['GET', 'POST'],
path: '/login',
config: {
auth: 'twitter',
handler: function (request, reply) {
if (!request.auth.isAuthenticated) {
return reply('Authentication failed due to: ' + request.auth.error.message);
}
return reply.redirect('/home');
}
}
});
server.start();
});