@bhc/bhcauthsdk

1.0.28 • Public • Published

install

npm i -s @bhc/bhcauthsdk

import

// in node
const bhcAuth = require('@bhc/bhcauthsdk').bhcAuth

usage

create a user

let auth = new bhcAuth(client_id, client_secret);

auth.createUser(user_login, user_password).then(user => {
});

login

let auth = new bhcAuth(client_id, client_secret);

auth.login(user_login, user_password).then(user => {
	console.log(user.getInfoUser());
});

bhcAuth

methods

constructor(client_ID, client_secret)
async createUser(username, password) //create a new user
async login(username, password) // login a user. return a User object
async refresh(refresh_token) // use a refresh_token to log a user
async verify(access_token) // verify the authenticity of a a token
verifyProvidedSource(access_token) // verify if the token was provided by you. A valid token may be provided by someone else, use this to ensure the token doesnt come from unexpected source.
getInfoFromToken(access_token) // return the info loaded in the token

user

methods

constructor(obj)
getAccessToken() // return the user access token
getInfoUser() // return the user info
getRefreshToken() // return the user refresh token
async refreshAccessToken() // refresh the access token
async changePassword(old_password, new_password) // change the user password

Readme

Keywords

none

Package Sidebar

Install

npm i @bhc/bhcauthsdk

Weekly Downloads

0

Version

1.0.28

License

ISC

Unpacked Size

7.53 kB

Total Files

8

Last publish

Collaborators

  • wrexes
  • lanath
  • sike