Nefarious Plastic Mannequins
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

township-accounts

4.0.3 • Public • Published

township-accounts

Node.js library for managing user accounts.

npm travis standard conduct

About

township-accounts is a high-level module based on township-auth, which manages authentication credentials, township-access, which manages authorization via access scopes, and township-token, which manages JWT tokens.

Install

npm install --save township-accounts

Usage

Create the accounts object by calling the townshipAccounts constructor:

var townshipAccounts = require('township-accounts')
var level = require('level')
var db = level('db')
 
var accounts = townshipAccounts(db, {
  secret: 'not very secret'
})

Create an account with the register method:

var creds = {
  email: 'hi@example.com',
  password: 'weee'
}
 
accounts.register(creds, function (err, account) {
  console.log(err, account)
})

Log in with the login method:

var creds = {
  email: 'hi@example.com',
  password: 'weee'
}
 
accounts.login(creds, function (err, account) {
  console.log(err, account)
})

Log out with the logout method:

accounts.logout(accountKey, function (err, account) {
  console.log(err, account)
})

See more in the API documentation

Documentation

Examples

Contributing

Contributions are welcome! Please read the contributing guidelines first.

Conduct

It is important that this project contributes to a friendly, safe, and welcoming environment for all. Read this project's code of conduct

Changelog

Read about the changes to this project in CHANGELOG.md. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Contact

License

ISC

install

npm i township-accounts

Downloadsweekly downloads

7

version

4.0.3

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
Report a vulnerability