Project

General

Profile

Actions

User Story #536

open

Feature #533: Authentication Hum Rahi

EPIC #534: Epic: User Authentication - Mobile & OTP

User Story 2: Back-End - OTP Generation & WhatsApp Integration

Added by Islam Mansoori about 1 month ago. Updated about 1 month ago.

Status:
To Do
Priority:
low
Assignee:
-
Target version:
Start date:
Due date:
% Done:

90%

Estimated time:
(Total: 0:00 h)

Description

As a System, I want to receive a mobile number, generate a secure OTP, and trigger a WhatsApp message, so that the user's identity can be verified.

  • In-Scope:
    • RESTful API endpoint (/api/v1/auth/request-otp).
    • OTP generation logic (6-digit numeric).
    • Integration with a WhatsApp Service Provider (e.g., Twilio, Meta Graph API).
    • Rate limiting per mobile number.
  • Out-of-Scope:
    • Verification of the OTP (handled in the next story/page).
    • User profile creation (handled after successful verification).
  • Acceptance Criteria (AC):
    • AC1: Endpoint accepts mobile_number and remember_me boolean.
    • AC2: Generate a unique 6-digit OTP and store it in the cache (e.g., Redis) with a 5-minute expiry.
    • AC3: Send the OTP via the configured WhatsApp API.
    • AC4: Return a 200 OK status upon successful handoff to the provider.
  • Validation Rules:
    • Rate Limit: Maximum 3 OTP requests per 10 minutes per IP/Number.
    • Data Integrity: Ensure the number is stripped of whitespace before processing.
  • Error Messages:
    • Too many requests: "Too many attempts. Please try again in 10 minutes."
    • Provider Down: "Unable to send OTP at this moment. Please try again later."
  • Definition of Done (DoD):
    • API endpoint documented in Swagger/OpenAPI.
    • OTP successfully received on a test device via WhatsApp.
    • Code reviewed and merged to the develop branch.
    • Integration tests for the WhatsApp provider passed.

Subtasks 10 (2 open8 closed)

Task #547: Create OTP Request API EndpointBackend completedzaid ali

Actions
Task #548: Implement OTP Generation LogicBackend completedzaid ali

Actions
Task #549: Implement Redis-Based OTP StorageBackend completedzaid ali

Actions
Task #550: Implement Kafka Event Publishing for OTP DeliveryBackend completedzaid ali

Actions
Task #551: Implement Kafka Listener for WhatsApp NotificationsBackend completedzaid ali

Actions
Task #552: Integrate Twilio WhatsApp Service for OTP DeliveryBackend completedzaid ali

Actions
Task #553: Implement Phone Number Validation and NormalizationBackend completedzaid ali

Actions
Task #554: Implement Error Handling for OTP RequestsIn Progresszaid ali

Actions
Task #555: Implement OTP Expiry ManagementBackend completedzaid ali

Actions
Task #556: Document OTP API Endpoint in Swagger/OpenAPITo Dozaid ali

Actions
Actions

Also available in: Atom PDF