Auth-Verify Node.js library for handling OTP, TOTP, JWT, Passkeys (Webauthn / Passwordless login), MagicLinks, Password Hashing and sending OTP various channels (Email, SMS, Telegram and WhatsApp).
GitHub โ DocumentationOTPManager โ for sending OTP and verifying itTOTPManager โ for generating Time-based OTP and make it QR codesJWTManager โ for signing, decoding, verifying, revoking, refreshing JWT tokensMagiclinkManager โ for making magic links and sending them to emailsOAuthManager โ for handling OAuth login and registrationnpm install auth-verify
CDN:
<script src="https://cdn.jsdelivr.net/gh/jahongir2007/auth-verify/auth-verify.client.js"></script>
You can get your OTP code by scanning QR code. (Make sure AuthVerify live demo web service is running)
const AuthVerify = require("auth-verify");
const auth = new AuthVerify({ storeTokens: "memory" });
// Connecting sender
auth.otp.sender({
via: 'email',
sender: 'johndoe@example.com',
pass: 'YOUR_APP_PASS',
service: 'gmail'
});
(async () => {
let sent = await auth.otp.send('alice@example.com');
if(sent) {
let valid = await auth.otp.verify('alice@example.com', auth.otp.code);
if(valid) console.log('Correct OTP code');
else console.log('Incorrect OTP code');
}
})();