SMS OTP (one-time password) is the most universal way to add two-factor authentication in Africa.

How to implement

  1. Generate a short random code (4-6 digits) and store it with a 3-5 minute expiry.
  2. Send it via the API with a registered sender ID.
  3. 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"}'

Most OTPs arrive within seconds, and every message gets a delivery report, so you can see whether a code arrived while it was still valid.