crp-account-client
v1.0.12
Published
CrowdProcess Account Client
Downloads
29
Readme
CrowdProcess Account Client
Basically about account CRUD and obtaining tokens. You know, user account stuff.
Getting it
$ # install it with
$ npm install --save crp-account-client
// require it
var Client = require('crp-account-client');
// initiallize the client with a username and a password
var client = Client({
username: myUsername,
password: myPassword
});
// or with a token
var client = Client({
token: myToken
});
// or with nothing at all, if you pretend to create an account
var client = Client();
Obtaining a Token
Of course you have to create an account first.
client.login({
email: '[email protected]',
password: 'a secure password'
}, function (err, token) {
if (!err)
console.log('now I can use my token:', token);
});
Account CRUD
Create
For this you should use the website.
View
client.account({
email: '[email protected]',
password: 'a secure password'
}).view(function (err, account) {
if (!err)
console.log('here\'s my account:', account);
});
Update
client.account({
email: '[email protected]',
password: 'a secure password'
}).update({
name: 'My New Name',
newPassword: 'safer password ?'
}, function (err) {
if (!err)
console.log('boom.. hope I remember my new password..');
});
Delete
client.account({
email: '[email protected]',
password: 'a secure password'
}).destroy(function (err) {
if (!err)
console.log('no more account :(');
})