Nitt Webmail Auth
1.0.0
用于 NIT-T Webmail 身份验证的 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"