To use Google Authenticator as a two-factor authentication method, you must first pair with the user's Google Authenticator App, by displaying a QR code to them. This QR code is generated using a secret code that only you know. When the user logs in, they must enter the code displayed on their authenticator app, which you validate against the secret code used earlier.
You can use the web service to pair, or call "https://www.authenticatorApi.com/pair.aspx" with the following parameters:
https://www.authenticatorApi.com/pair.aspx?AppName=MyApp&AppInfo=John&SecretCode=12345678BXYT
You can use the web service to validate a pin, or call "https://www.authenticatorApi.com/Validate.aspx" with the following parameters:
https://www.authenticatorApi.com/Validate.aspx?Pin=123456&SecretCode=12345678BXYT
Two-factor authentication (2FA) is a security mechanism that requires users to provide two separate forms of verification before gaining access to an account or system. The first factor is typically something the user knows — such as a password — while the second factor is something the user possesses, such as a time-sensitive code generated by an authenticator app.
By requiring both factors, 2FA dramatically reduces the risk of unauthorised access, even if a user’s password has been compromised. Authenticator app-based 2FA is considered significantly more secure than SMS-based alternatives, which are vulnerable to SIM-swapping and interception attacks.
TOTP stands for Time-based One-Time Password, the open standard (defined in RFC 6238) that underpins Google Authenticator, Authy, Microsoft Authenticator, and most other authenticator apps.
A TOTP code is derived from a shared secret key and the current Unix timestamp, producing a new 6-digit code every 30 seconds. Because codes expire rapidly and the shared secret never travels over the network during login, TOTP is highly resistant to phishing and replay attacks. The algorithm is an open standard, meaning any compliant implementation — including this API — is fully interoperable with Google Authenticator and other TOTP-compatible apps.
AuthenticatorAPI.com provides a simple, free, hosted REST API that allows developers to add Google Authenticator-compatible two-factor authentication to any application, regardless of programming language or platform.
There are no SDKs to install and no libraries to manage — just standard HTTP GET requests. The API exposes two core operations:
Integrating Google Authenticator into your app takes just a few steps:
true or false — and you grant or deny access
accordingly.AuthenticatorAPI.com is suitable for any scenario where you need to add a second layer of authentication without building TOTP logic from scratch.
Protect admin panels, customer accounts, or sensitive data with a simple API call during login.
Add 2FA to internal dashboards or employee portals without complex infrastructure or dependencies.
Retrofit two-factor authentication onto existing systems that don’t natively support it.
Add working 2FA to a prototype in minutes using any language that can make HTTP GET requests.
When implementing two-factor authentication, keep the following best practices in mind:
The full source code for this API is available on GitHub. You are welcome to inspect the implementation, self-host it, or contribute improvements. The codebase serves as a useful reference for anyone wanting to understand how TOTP generation and validation works in practice, and is freely available under an open licence.