gluestick/get-token.js

22 lines
489 B
JavaScript

const dotenv = require("dotenv");
dotenv.config({ path: ".env.local" });
async function main() {
const url = `http://${process.env.LDAP_HOST}:17170/auth/simple/login`;
const req = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
username: process.env.LDAP_BIND_USER,
password: process.env.LDAP_BIND_PASSWORD
})
});
const res = await req.json();
console.log(res.token);
}
main();