2019-03-24 14:15:49 +00:00
|
|
|
/*
|
|
|
|
* This is just client script to test the fake API.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const DuoApi = require("@duosecurity/duo_api");
|
|
|
|
|
|
|
|
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
|
|
|
|
|
|
|
|
const client = new DuoApi.Client("ABCDEFG", "SECRET", "duo.example.com");
|
2021-12-01 03:32:58 +00:00
|
|
|
console.log("Testing Auth API first");
|
|
|
|
client.jsonApiCall(
|
|
|
|
"POST",
|
|
|
|
"/auth/v2/auth",
|
|
|
|
{ username: "john", factor: "push", device: "auto" },
|
|
|
|
console.log
|
|
|
|
);
|
|
|
|
console.log("Testing PreAuth API second");
|
|
|
|
client.jsonApiCall(
|
|
|
|
"POST",
|
|
|
|
"/auth/v2/preauth",
|
|
|
|
{ username: "john" },
|
|
|
|
console.log
|
|
|
|
);
|