WhatsApp Authentication Flow
Mubarokah ID allows users to register and sign in using their WhatsApp number. This provides a fast, frictionless experience, but it introduces a key difference for developers: the absence of a verified email address.Key Differences
| Feature | Email Registration | WhatsApp Registration |
|---|---|---|
| Identifier | Email Address | Phone Number |
| Verification | Email Link / OTP | WhatsApp OTP |
| User Info Response | email is populated | email is null |
| Primary Key | id (numeric) | id (numeric) |
Handling WhatsApp Users
When a user authenticates via WhatsApp, the/api/user endpoint will return a response where the email field is null.
Example User Response (WhatsApp User)
Best Practices for Client Apps
1. Use mubarokah_id as Primary Key
Do not use email as the unique identifier in your application’s users table. Instead, map your local users to the Mubarokah ID unique identifier.
2. Implement Fallback Emails
If your application logic strictly requires an email address (e.g., for sending notifications), you can generate a synthetic internal email as a fallback until the user provides a real one.3. Support Profile Completion
If your app needs a real email for business reasons, detect thenull email in your dashboard and prompt the user to:
- “Link your Email Address to receive order updates.”
- Redirect them to the Mubarokah ID Profile page to add their email.
SDK Support
Our official React SDK and Laravel Integration have been updated to handle these flows seamlessly.- The React SDK provides
isAuthenticatedanduserstate regardless of whether an email exists. - The Laravel Guide now shows how to use
mubarokah_idfor resilient user synchronization.
Note on Security: Phone numbers are verified via WhatsApp OTP before being returned to your application, ensuring they are as trustworthy as verified email addresses.