getToken.js
371 Bytes
const su = require('superagent')
module.exports = (token, payload) => {
const headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': `Basic ${token}`
}
return su.post(`${process.env.SENATICS_URL}/auth/token`)
.set(headers)
.send(JSON.stringify(payload))
.retry(3)
.then(response => response.body)
}