1.0.10 • Published 5 years ago

@bhc/react-native-bhc-auth v1.0.10

Weekly downloads
11
License
ISC
Repository
-
Last release
5 years ago

install

npm i -s @bhc/bhcauthsdk

import

// in es6
import bhcAuth, {getUri, getQuery, Query, User, XMLHttpRequestAsync} from '@bhc/bhcauthsdk'

// in node
require = require("@std/esm")(module) // or use --experimental-modules flag
const bhcAuth = require('@bhc/bhcauthsdk').default

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.10

5 years ago

1.0.9

5 years ago

1.0.8

5 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