@iotechpis/ioaccount
```` npm i @iotechpis/ioaccount -s ````
Last updated 16 days ago by iodevteam .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @iotechpis/ioaccount 
SYNC missed versions from official npm registry.

npm-iotechpis_ioaccount

Install

npm i @iotechpis/ioaccount -s

How to use

Init

//Mongo connection for ioTokens DB
const mongodb_connection = "mongodb://username:password@0.0.0.0:27017/db";
//URL for ioaccount API
const ioaccount_api = "https://ioaccountapi.com";

const current_app_id = 78345673457;
const token_expiration_time = 15000; //in sec

require("@iotechpis/ioaccount").init(mongodb_connection, ioaccount_api, current_app_id, token_expiration_time, callback);

auth

.login(email, password, callback)

let email = "m@domain.com";
let password = "12345";

require("@iotechpis/ioaccount").auth.login(email, password, (error, data) => {
//data = {headers, body};
});

.logout(token, callback)

let token= "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVDJ9.eyJpZCI6ImNmN2FmODNiZDE0Yjk4Zjg5NTgyOTkzYjljMmQxZDQ1OGQxMTA1NGI0NGU1MGIxM2E5Y3FiOGM4ODJhNTQ0OTc2NWUxMWQ3NTk1YzRlNjI4IiwidHlwZSI6IkNvbXBhbnkiLCJp1vB537z3wuE_ph_kJ9-5kuxgaPcjYk4txYm1s";

require("@iotechpis/ioaccount").auth.logout(token, () => {

});

.info(token, callback)

let token= "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVDJ9.eyJpZCI6ImNmN2FmODNiZDE0Yjk4Zjg5NTgyOTkzYjljMmQxZDQ1OGQxMTA1NGI0NGU1MGIxM2E5Y3FiOGM4ODJhNTQ0OTc2NWUxMWQ3NTk1YzRlNjI4IiwidHlwZSI6IkNvbXBhbnkiLCJp1vB537z3wuE_ph_kJ9-5kuxgaPcjYk4txYm1s";

require("@iotechpis/ioaccount").auth.info(token, (error, data) => {
//data = {headers, body};
});

.recoverPasswordRequest(email, callback)

let email = "email@domain.com";

require("@iotechpis/ioaccount").auth.recoverPasswordRequest(email, (error, data) => {
//data = {headers, body};
});

tokens

.create(payload, callback)

let payload = {
	user_id: "1", //only this field is obligatory, the others can be whatever you want
};

require("@iotechpis/ioaccount").tokens.create(payload, (token) => {
});

.delete(token, callback)

let token= "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVDJ9.eyJpZCI6ImNmN2FmODNiZDE0Yjk4Zjg5NTgyOTkzYjljMmQxZDQ1OGQxMTA1NGI0NGU1MGIxM2E5Y3FiOGM4ODJhNTQ0OTc2NWUxMWQ3NTk1YzRlNjI4IiwidHlwZSI6IkNvbXBhbnkiLCJp1vB537z3wuE_ph_kJ9-5kuxgaPcjYk4txYm1s";

require("@iotechpis/ioaccount").tokens.delete(token, () => {
});

.validate(token, callback)

let token= "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVDJ9.eyJpZCI6ImNmN2FmODNiZDE0Yjk4Zjg5NTgyOTkzYjljMmQxZDQ1OGQxMTA1NGI0NGU1MGIxM2E5Y3FiOGM4ODJhNTQ0OTc2NWUxMWQ3NTk1YzRlNjI4IiwidHlwZSI6IkNvbXBhbnkiLCJp1vB537z3wuE_ph_kJ9-5kuxgaPcjYk4txYm1s";

require("@iotechpis/ioaccount").tokens.validate(token, (error, token, payload) => {
});

user

.register(email, password, confirm_password, callback)

let email = "name@domain.com";

require("@iotechpis/ioaccount").user.register(email, (error, data) => {
//data = {headers, body};
});

.registerMany(users, callback)

let users = [
    {
        "email": "johnsm@email.com"
    }, ...
];
  
require("@iotechpis/ioaccount").user.registerMany(users, (error, data) => {
//data = {headers, body};
});

.getByIds(users, callback)

let ids = [
    "rgjregjenrg",
    "rwjegnregn"
];
  
require("@iotechpis/ioaccount").user.getByIds(ids, (error, data) => {
//data = {headers, body};
});

Current Tags

  • 2.2.0                                ...           latest (16 days ago)

21 Versions

  • 2.2.0                                ...           16 days ago
  • 2.1.2                                ...           a month ago
  • 2.1.1                                ...           a month ago
  • 2.1.0                                ...           a month ago
  • 2.0.3                                ...           a month ago
  • 2.0.2                                ...           a month ago
  • 2.0.1                                ...           a month ago
  • 2.0.0                                ...           a month ago
  • 1.2.2                                ...           2 months ago
  • 1.2.1                                ...           2 months ago
  • 1.2.0                                ...           2 months ago
  • 1.1.1                                ...           6 months ago
  • 1.1.0                                ...           6 months ago
  • 1.0.7                                ...           6 months ago
  • 1.0.6                                ...           6 months ago
  • 1.0.5                                ...           6 months ago
  • 1.0.4                                ...           6 months ago
  • 1.0.3                                ...           6 months ago
  • 1.0.2                                ...           7 months ago
  • 1.0.1                                ...           7 months ago
  • 1.0.0                                ...           7 months ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 21
Last Month 43
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |