SMS OTP (one-time password) is the most universal way to add two-factor authentication in Africa.
How to implement
- Generate a short random code (4–6 digits) and store it with a 3–5 minute expiry.
- Send it via the API with a registered sender ID.
- Ask the user to enter the code, then verify it against what you stored.
curl -X POST "https://sms.esmsafrica.io/api/messages/send" \
-H "Authorization: Bearer $ESMS_TOKEN" \
-d '{"to":"+254712345678","text":"Your code is 482910","sender_id":"Verify"}'
Our direct routes deliver OTPs in seconds with 99%+ success — essential so codes arrive while still valid.