Neufund / authentication-client

Client side library for the authentication-server
MIT License
3 stars 1 forks source link

authentication-client Build Status

Greenkeeper badge Client side library for the authentication-server

Example usage

Registration

const API_URL = 'http://localhost:3000';
const authenticator = new Authenticator(API_URL);
const otpSecret = await authenticator.register(email, password, captcha);
// Register otpSecret somewhere (e.g. show QR code for Google authenticator)

Login

const API_URL = 'http://localhost:3000';
const authenticator = new Authenticator(API_URL);
// Ask client for otpToken (2FA)
const jwt = await authenticator.login(email, password, otpToken);
// Use jwt to login

Install deps

yarn

Run tests

yarn test