Nitt Webmail Auth
1.0.0
NIT-T용 웹메일 인증을 위한 JavaScript 패키지
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 모듈. package.json에 "type" : "module"
이 있는지 확인하세요.