Complete Code
const axios = require('axios')
const API_URL = 'https://xxxxxxxxxx.execute-api.xx-xxxx-x.amazonaws.com/prod'
const API_KEY = '< API key >'
const USERNAME = '< your MIC username >'
const PASSWORD = '< your MIC password >'
const api = axios.create({
baseURL: API_URL,
headers: {
'x-api-key': API_KEY
}
})
const main = async () => {
try {
const response = await api({
method: 'post',
url: '/auth/login',
data: {
userName: USERNAME,
password: PASSWORD
}
})
console.log('Auth API response:', response.data)
} catch (e) {
console.error('An error occured:', e)
}
}
main()