1.0.28 • Published 5 years ago
@bhc/bhcauthsdk v1.0.28
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
1.0.28
5 years ago
1.0.26
5 years ago
1.0.27
5 years ago
1.0.25
5 years ago
1.0.24
6 years ago
1.0.23
6 years ago
1.0.22
6 years ago
1.0.19
6 years ago
1.0.18
6 years ago
1.0.21
6 years ago
1.0.20
6 years ago
1.0.15
6 years ago
1.0.14
6 years ago
1.0.13
6 years ago
1.0.12
6 years ago
1.0.11
6 years ago
1.0.10
6 years ago
1.0.9
6 years ago
1.0.8
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago