middleware/mw.auth.social.js
function init(ctx) {
        var server = ctx.server;
        var deferred = Q.defer();

        server.register({register: require('bell')}, function (err) {

            if (err) {
                deferred.reject(err);
                return;
            }

            _.each(config.security.social, function (providerConfig, providerName) {
                var opts = _.extend({}, config.security.cookie, {
                    'cookie': 'bell-' + providerName,
                    'clientId': providerConfig.appId,
                    'clientSecret': providerConfig.appSecret,
                    'isSecure': config.useSSL,
                    'forceHttps': config.useSSL,
                    'provider': getProvider(providerName, providerConfig)
                });

                server.auth.strategy(providerName, 'bell', opts);
            });

            deferred.resolve();
        });

        return deferred.promise.then(function () {
            return Q.when(ctx);
        });
    }
function init(ctx) {
        var server = ctx.server;
        var deferred = Q.defer();

        server.register({register: require('bell')}, function (err) {

            if (err) {
                deferred.reject(err);
                return;
            }

            _.each(config.security.social, function (providerConfig, providerName) {
                var opts = _.extend({}, config.security.cookie, {
                    'cookie': 'bell-' + providerName,
                    'clientId': providerConfig.appId,
                    'clientSecret': providerConfig.appSecret,
                    'isSecure': config.useSSL,
                    'forceHttps': config.useSSL,
                    'provider': getProvider(providerName, providerConfig)
                });

                server.auth.strategy(providerName, 'bell', opts);
            });

            deferred.resolve();
        });

        return deferred.promise.then(function () {
            return Q.when(ctx);
        });
    }
function init ( ctx ) { var server = ctx . server ; var deferred = Q . defer ( ) ; server . register ( { register : require ( 'bell' ) } , function ( err ) { if ( err ) { deferred . reject ( err ) ; return ; } _ . each ( config . security . social , function ( providerConfig , providerName ) { var opts = _ . extend ( { } , config . security . cookie , { 'cookie' : 'bell-' + providerName , 'clientId' : providerConfig . appId , 'clientSecret' : providerConfig . appSecret , 'isSecure' : config . useSSL , 'forceHttps' : config . useSSL , 'provider' : getProvider ( providerName , providerConfig ) } ) ; server . auth . strategy ( providerName , 'bell' , opts ) ; } ) ; deferred . resolve ( ) ; } ) ; return deferred . promise . then ( function ( ) { return Q . when ( ctx ) ; } ) ; }
Use the Hapi Bell plugin to register the social auth providers
@param ctx
Use the Hapi Bell plugin to register the social auth providers