Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

accounts

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accounts

Accounts Management module

latest
Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
19
111.11%
Maintainers
1
Weekly downloads
 
Created
Source

node-accounts

accounts is a simple User Management module for Node.js.

Current version supports logins only with providers(Google, Yahoo, Facebook, etc.).

Usage

All you need to do is to create an application, and then use appId for managing users.

Create a new app

var Accounts = require('accounts')(storage, options);
var appId;

Accounts.apps.create({
    name: 'Test app'
  }).then(function(app) {
    appId = app.id;
  });

Provider login

var Accounts = require('accounts')(storage);
var appId = process.env.ACCOUNTS_APP_ID;
var App = Accounts.app(appId);

App.login('social', profile)
  .then(function(user) {
    if (user) {
      console.log(user);
    }
    else {
      console.log('login faild');
    }
  });

Where Profile is a Passport User Profile

var profile = {
  provider: 'facebook',
  id: '123124234235123',
  displayName: 'Dumitru K',
  accessData: {
    accessToken:'dsgsgs', refreshToken:'gerge'
  }
};

API

(storage, options)

Creates a new Client.

Client API

admin

  • sync() - Syncronize DB tables.
  • drop(secret) - Drop DB tables. Useful for tests.

apps

  • create(data) - Create a new application.
  • getById(id) - Get an application by id.

app(appId)

Creates a new Application Client for a given app id.

Application Client API

login(type, data, options) - User login.

users

  • create(data, options) - Create a new user.
  • getById(id, options) - Get an user object by id.
  • update(data, options) - Update user fields.
  • deleteById(id, options) - Delete an user by id.

identities

  • create(data, options) - Create a new identity.
  • getById(id, options) - Get an user identity by id.
  • findByUserId(userId, options) - Find user identities by user id.
  • update(data, options) - Update an identity.
  • deleteById(id, options) - Delete an user identity by id.
  • deleteByUserId(userId, options) - Delete user identities by user id.

Storages

Keywords

accounts

FAQs

Package last updated on 30 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts