For a multi-factor authentication library, the first results are google/google-authenticator, lucia-auth/lucia (Lucia is an authentication library that includes built-in TOTP two-factor authentication and recovery code generation, exactly matching your need for a backend-integrated MFA solution with TOTP and recovery options) and supertokens/supertokens-core (SuperTokens is a self-hosted authentication platform with a dedicated recipe for TOTP-based multi-factor authentication, offering QR provisioning, backup codes, and configurable OTP settings directly via its API and SDKs for backend integration). pennersr/django-allauth and steveiliop56/tinyauth round out the shortlist. Compare the match explanations and check the project documentation against your requirements.
Implement secure multi-factor authentication and time-based one-time password verification in your backend application services.
This is a two-factor authentication library and open-source multi-factor authentication implementation. It provides a suite of tools for implementing security workflows that require a second layer of verification beyond standard credentials. The project implements both time-based one-time passwords and HMAC-based one-time passwords. It includes utilities for generating these codes based on shared secrets and counters, following industry standards such as RFC 6238. The library covers cryptographic primitives including Base32 secret key encoding, dynamic truncation extraction, and symmetric ke
This Java library implements TOTP and HOTP generation and validation according to RFC 6238, which directly fits your need for integrating multi-factor authentication into a backend application, though the provided evidence does not explicitly confirm backup codes or rate-limiting features.
Lucia is an authentication library that provides session management, OAuth integration, and password-based login for web applications. It creates and validates server-side sessions using cryptographically random tokens stored in HttpOnly, Secure, SameSite=Lax cookies, with constant-time token comparison to prevent timing side-channel attacks. The library supports authentication through email and password, GitHub OAuth, Google OAuth, and passkey-based sign-in. It enforces two-factor authentication using time-based one-time passwords (TOTP) from authenticator apps, generates recovery codes for
Lucia is an authentication library that includes built-in TOTP two-factor authentication and recovery code generation, exactly matching your need for a backend-integrated MFA solution with TOTP and recovery options.
SuperTokens Core is an open-source, self-hosted authentication and identity management platform designed for deployment within private infrastructure. It provides a comprehensive suite for managing user accounts, roles, and secure authentication flows, utilizing a modular, recipe-based architecture that allows developers to enable specific security features without modifying the core codebase. The platform distinguishes itself through its robust multi-tenancy capabilities, which allow for the logical or physical isolation of user records and configuration settings across different organizatio
SuperTokens is a self-hosted authentication platform with a dedicated recipe for TOTP-based multi-factor authentication, offering QR provisioning, backup codes, and configurable OTP settings directly via its API and SDKs for backend integration.
django-allauth is a comprehensive authentication framework for Django applications that manages user registration, account ownership verification, and secure login processes. It provides a system for handling the entire user account lifecycle, including the ability to define custom signup fields and implement identity verification. The project distinguishes itself by providing a suite of OAuth and SAML integrations for social account authentication and the capability to act as an OpenID Connect identity provider. It further supports decoupled architectures through a token-based headless authe
django-allauth is a comprehensive Django authentication framework that includes two-factor authentication (with TOTP support) and covers rate limiting and brute-force protection, making it a solid choice for adding MFA to a Django backend, though it is broader than a focused TOTP library.
Tinyauth is an authentication middleware service and identity provider that verifies user identities to grant system access. It operates as a standalone server or as an authentication gateway, utilizing a reverse proxy model to intercept requests and validate credentials before traffic reaches protected backend services. The project functions as an OpenID Connect provider for single sign-on experiences and an OAuth 2.0 gateway that delegates verification to external providers such as Google and GitHub. It also acts as an LDAP authentication server, allowing for centralized user management and
Tinyauth is an authentication middleware service that supports TOTP-based two-factor authentication, making it a viable option for integrating MFA into a backend via a reverse proxy model, though it is a broader identity provider rather than a focused TOTP library.
Keycloak is an open-source identity and access management server that provides a centralized platform for user authentication, authorization, and identity federation. It functions as a standards-compliant identity provider, utilizing a centralized engine to validate credentials and issue cryptographically signed tokens based on industry-standard protocols like OpenID Connect and SAML. This enables organizations to secure diverse applications and services through a unified authentication layer. The platform distinguishes itself through its cloud-native orchestration and high-availability capab
Keycloak is a full identity and access management server with built-in multi‑factor authentication support, including TOTP generation, validation, and QR code provisioning, making it a deployable service for adding OTP‑based second factor to backend applications.
A One Time Password Authentication package, compatible with Google Authenticator.
This PHP package provides TOTP generation and validation compatible with Google Authenticator, making it a straightforward library for integrating OTP-based multi-factor authentication into your backend application; it covers the core TOTP features but may require additional implementation for backup codes or rate limiting.
This project is a Pluggable Authentication Module for Linux systems that enforces multi-factor identity verification. It integrates directly into the system authentication stack to require time-based one-time passwords alongside standard user credentials, providing a mechanism to secure local and remote shell access. The module distinguishes itself through its implementation of the time-based one-time password algorithm, which includes built-in support for clock-skew compensation to account for time discrepancies between servers and user devices. It manages individual user secret keys through
This is a PAM module that provides TOTP-based two-factor authentication for Linux systems, integrating directly into the system-level authentication flow — it is a genuine TOTP library but is limited to PAM environments and lacks built-in backup codes or rate limiting.
This project provides a complete OpenVPN server deployment packaged as a Docker container, with an integrated EasyRSA certificate authority for automated public-key infrastructure management. It handles the full lifecycle of a VPN server, from initial PKI bootstrap and server configuration generation to client certificate issuance and revocation, all within a containerized environment. The server is configured entirely through Docker environment variables, eliminating the need for manual configuration file editing. It supports time-based one-time password (TOTP) authentication as a second fac
Although kylemanna/docker-openvpn supports TOTP as a second authentication factor, it is a complete OpenVPN server deployment — not a reusable library or SDK for integrating MFA into a backend application, so it doesn't match the core identity you're after.
Aegis is a mobile application designed to manage and store multi-factor authentication tokens. It functions as a local-first credential vault that generates time-based and counter-based one-time passwords to verify user identity across various online services. The application secures sensitive authentication data by employing authenticated symmetric encryption and hardware-backed key storage to protect credentials at rest. Access to the stored tokens is gated by system-level biometric authentication or password verification, ensuring that only authorized users can retrieve the generated secur
Aegis is a mobile authenticator app for end users that generates TOTP tokens, not a library or SDK for integrating TOTP into a backend application.
Shortest is an AI-driven end-to-end testing framework and quality assurance engine that translates plain English descriptions into executable browser actions and API assertions. It functions as a natural language test automation tool, interpreting text-based scenarios to verify application behavior and user workflows. The system differentiates itself by using large language models to map natural language to browser commands and by automating multi-factor authentication through the generation of codes from stored secrets. It further extends automation capabilities by allowing the injection of
Shortest is an AI-driven end-to-end testing framework that can generate TOTP codes for automated MFA handling, but it is not a library or service for integrating TOTP into a backend application — it is a test automation tool, not the TOTP implementation itself.
This project is an Android password manager application that provides an end-to-end encrypted vault for storing and synchronizing login credentials, secure notes, and identities. It functions as a secure storage system using zero-knowledge encryption to ensure that only the user can decrypt their stored data. The application integrates directly with the Android system to provide an autofill service that populates usernames and passwords into mobile apps and browser login fields. It also serves as a passkey management wallet for FIDO2 cryptographic passkeys and a time-based one-time password a
This is an Android client app for the Bitwarden password manager that stores and generates TOTP codes, but it is not a backend library or service you can integrate into your own application to handle TOTP generation or validation.
| Repository | Stars | Language | License | Last push |
|---|---|---|---|---|
| google/google-authenticator | 5.3K | Java | Apache-2.0 | |
| lucia-auth/lucia | 10.5K | — | 0BSD | |
| supertokens/supertokens-core | 14.9K | Java | other | |
| pennersr/django-allauth | 10.3K | Python | MIT | |
| steveiliop56/tinyauth | 7K | Go | gpl-3.0 | |
| keycloak/keycloak | 34.9K | Java | Apache-2.0 | |
| antonioribeiro/google2fa | 2K | PHP | MIT | |
| google/google-authenticator-libpam | 2K | C | Apache-2.0 | |
| kylemanna/docker-openvpn | 9.1K | Shell | MIT | |
| beemdevelopment/aegis | 12.6K | Java | GPL-3.0 |