All in one

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 โ†’ Documentation

๐Ÿš€ Features

Backend

  • OTPManager โ€” for sending OTP and verifying it
  • TOTPManager โ€” for generating Time-based OTP and make it QR codes
  • JWTManager โ€” for signing, decoding, verifying, revoking, refreshing JWT tokens
  • MagiclinkManager โ€” for making magic links and sending them to emails
  • OAuthManager โ€” for handling OAuth login and registration

๐Ÿ“ฆ Install

npm install auth-verify

CDN:

<script src="https://cdn.jsdelivr.net/gh/jahongir2007/auth-verify/auth-verify.client.js"></script>

๐Ÿงช Live Demo

You can get your OTP code by scanning QR code. (Make sure AuthVerify live demo web service is running)



๐Ÿ’ก Example Usage


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');   
  }
})();