Node.js library for managing user accounts.
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.
npm install --save township-accounts
var townshipAccounts = require('township-accounts')
var level = require('level')
var db = level('db')
var accounts = townshipAccounts(db, {
secret: 'not very secret'
})
var creds = {
email: 'hi@example.com',
password: 'weee'
}
accounts.register(creds, function (err, account) {
console.log(err, account)
})
var creds = {
email: 'hi@example.com',
password: 'weee'
}
accounts.login(creds, function (err, account) {
console.log(err, account)
})
accounts.logout(accountKey, function (err, account) {
console.log(err, account)
})
See more in the API documentation
Contributions are welcome! Please read the contributing guidelines first.
It is important that this project contributes to a friendly, safe, and welcoming environment for all. Read this project's code of conduct
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.
- issues – Please open issues in the issues queue
- twitter – Have a question? @sethdvincent
- email – Need in-depth support via paid contract? Send an email to sethvincent@gmail.com