Nitt Webmail Auth
1.0.0
แพ็คเกจ JavaScript สำหรับการตรวจสอบสิทธิ์เว็บเมลสำหรับ NIT-T
npm i nitt-webmail-auth
(async() =>{
/*
Arguments for Authenticator object:
{
publicUrl = "<>", // if you have an external endpoint for login
useWebmailDirectly = false, // If webmail servers are reachable, set this to true
imapPort = 993 // the port for imap
}
Returns:
true/false that indicates if the credentials are right or wrong, if useWebmailDirectly is set to true
(OR)
The response of the external endpoint, if useWebmailDirectly is set to false and PublicUrl is provided
*/
const authenticator = new Authenticator({ useWebmailDirectly: true });
const response = await authenticator.login({
username: "<>", // rollno/username, wihtout @nitt.edu
password: "<>",
pingBeforeLogin: true, // checks if the server is reachable
});
console.log(response);
})();
หมายเหตุ: โมดูล ES6 ตรวจสอบให้แน่ใจว่าคุณมี "type" : "module"
ใน package.json ของคุณ