npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lb-satellizer

v2.2.1

Published

Loopback Module for Token Based 3rd Party (Oauth) Authentication with satellizer

Downloads

4

Readme

lb-satellizer

** !!! This Module is under development and should not be used in production !!! **

lb-satellizer integrates 3rd party (facebook, twitter, etc.) authentication for loopback. The purpose of this module is to set up remote methods to authenticate (login), link and unlink with multiple social media providers.

Supported Providers:

Setup:

$npm install lb-satellizer --save $npm install lb-satellizer-facebook --save

In your server/config.json, add the name of your User model and all provider specific data:

...
"satellizer": {
    "userModel": "user",
    "providers": {
      "facebook": {
        "secret": "****"
      }
    }
  }

Then in your server/boot/authentication.js, or any other bootfile add:

const loopback = require('loopback');
      satellizer = require('lb-satellizer');
      facebook = require('lb-satellizer-facebook');
      twitter = require('lb-satellizer-twitter');
      satellizerConfig = require('../config.json').satellizer;

module.exports = function enableAuthentication(server) {
...
  const providers = [{provider: facebook, name: 'facebook'},
  				           {provider: twitter, name: 'twitter'}]
  // Use Satellizer for authetication
  satellizer(server, providers, satellizerConfig, loopback);
};

Finally, add the respective properties and acls for the supported remote methods to your User model. (lb-satellizer sets fullname and providername)

"properties": {
	...
    "fullname": {
      "type": "string"
    },
    "facebook": {
      "type": "number"
    },
    "twitter": {
      "type": "number"
    },
"acls": [
	...
    {
      "accessType": "EXECUTE",
      "principalType": "ROLE",
      "principalId": "$everyone",
      "permission": "ALLOW",
      "property": "unlink"
    },
    {
      "accessType": "EXECUTE",
      "principalType": "ROLE",
      "principalId": "$everyone",
      "permission": "ALLOW",
      "property": "auth"
    }
  ]

Satellizer Integration:

To use lb-satellizer with angular satellizer, add the following parameters to your angular config

.config(['satellizer.config', '$authProvider', function (config, $authProvider) {

    config.unlinkUrl = 'api/users/auth/unlink/';

    $authProvider.facebook({
      url: 'api/users/auth/facebook',
      clientId: 'your_facebook_client_id'
    });

    $authProvider.twitter({
      url: 'api/users/auth/twitter'
    });

}])

Routes:

lb-satellizer exposes following routes via remote methods:

  • auth: POST /users/auth/{provider}
  • unlink: GET /users/auth/unlink/{provider}

Changelog:

2.2.0 :

  • Fixed a major Bug which, in combination with the FB Graph API v2.5, did overwrite random user profiles

2.0.0 :

  • Upgraded to use ES6 with Node Version 5.5.0
  • Former link method is now merged with User.auth, this means better compatibility with Satellizer. Linking of a provider with an existing user account is now performed if the method is called with a valid accesstoken.
  • Improved Code Documentation

1.2.1 :

  • Fix major user check Bug that prevented generation of new users
  • Add missing link functionality for oauth

1.1.0 :

  • Add OAuth1 support (Twitter)
  • Support multiple providers via Array (see setup)
  • Add routes description with supported providers

Future plans:

  • Add full example with angular satellizer integration and test specs
  • Make it possible to fetch specified profile properties
  • Add support for additional providers
  • Add support for JWT
  • Modfiy/manage routes via config file