1.0.6 • Published 6 years ago
bordino-authenticate v1.0.6
bordino-authenticate
/!\ This package is used and maintained by the DSITN Innovation
Installation
npm install --save bordino-authenticate
Usage
const BordinoAuthenticate = require('bordino-authenticate')
//or
import BordinoAuthenticate from 'bordino-authenticate';
const conf = {authServerURL: 'http://myAuthServer/'}
const bordinoAuthenticate = BordinoAuthenticate(conf)
there is two main functionnality :
- Login
- validateToken
Interally use axios
package to do the requests and return Promise
Login
accept a password
as param and return a validate token to ensure authentification to the services.
bordinoAuthenticate.login('mypassword')
.then((token)=>{
//use the token
})
.catch((e)=>(
//handle error
))
ValidateToken
accept a token
previously get from login or passed and return if the token is valide to ensure authentification to the services.
bordinoAuthenticate.validateToken('mytoken')
.then((isValide)=>{
//do your job
})
.catch((e)=>(
//handle error
))