SDKs for Node, PHP, Go and Python
Free and open-source clients for the aut2fa API. All four cover the same three endpoints: send a code, check its status and verify what the user typed.
Read the API docsSend a code and verify it
import { Aut2fa } from "@aut2fa/node";
const aut2fa = new Aut2fa(process.env.AUT2FA_API_KEY);
const send = await aut2fa.send({ to: "+5531999999999" });
// The user typed 482913
const result = await aut2fa.verify(send.id, { code: "482913" });
console.log(result.valid); // trueSend a code and verify it
use Aut2fa\Aut2fa;
$aut2fa = new Aut2fa(getenv('AUT2FA_API_KEY'));
$send = $aut2fa->send(['to' => '+5531999999999']);
// The user typed 482913
$result = $aut2fa->verify($send->id, ['code' => '482913']);
var_dump($result->valid); // trueSend a code and verify it
import "github.com/jhowbhz/aut2fa-go"
client, err := aut2fa.New(os.Getenv("AUT2FA_API_KEY"))
if err != nil {
return err
}
send, err := client.Send(ctx, aut2fa.SendParams{To: "+5531999999999"})
if err != nil {
return err
}
// The user typed 482913
result, err := client.Verify(ctx, send.ID, "482913")
if err != nil {
return err
}
fmt.Println(result.Valid) // trueSend a code and verify it
import os
from aut2fa import Aut2fa
client = Aut2fa(os.environ["AUT2FA_API_KEY"])
send = client.send(to="+5531999999999")
# The user typed 482913
result = client.verify(send.id, code="482913")
print(result.valid) # True