authentic-client-es6-promises
Version:
Porting of authentic-client to ES6 & native promises
25 lines (19 loc) • 500 B
JavaScript
var Authentic = require('../')
var auth = Authentic({
server: 'https://auth.scalehaus.io'
})
var creds = {
email: 'chet@scalehaus.io',
password: 'notswordfish'
}
// Step 1: log in
auth.login(creds, function (err) {
if (err) return console.error(err)
// Step 2: make a JSON request with authentication
var url = 'https://reporting.scalehaus.io/report'
auth.get(url, function (err, data) {
if (err) return console.error(err)
// show that report
console.log(data)
})
})