About login authentication

Wawp’s Authentication & Login endpoints are designed to make device onboarding and re-authentication fast, secure, and developer-friendly.

Best practices

  • Store the 'instance_id' in your database linked to your internal user ID.

  • Implement a 'Session Manager' page where users can see their current connection status.

  • Listen for 'DISCONNECTED' or 'LOGOUT' webhook events to notify users they need to re-scan.

  • Use the /v2/logout endpoint before deleting an instance to ensure a clean disconnection from WhatsApp servers.

Seamless Onboarding: The Architecture of Wawp Authentication

Wawp’s Authentication & Login infrastructure is engineered to solve the most difficult hurdle in WhatsApp automation: Secure, reliable, and frictionless device linking. Our system treats authentication not as a one-time event, but as a continuous, interactive handshake between your application, our high-performance engine, and the official WhatsApp network.

Screenshot 2025-09-11 003415.png


🏗️ The "Interactive Handshake" Philosophy

Unlike legacy solutions that require manual session-file management, Wawp uses an Isolated Engine Model. When you initiate an authentication flow, we spin up a dedicated, containerized instance specifically for your session. This provides several critical advantages:

  1. Sandboxed Security: Each session’s encryption keys and WebSocket bridges are physically separated from other users.
  2. State Transparency: Through our Authentication endpoints, you can visualize exactly what the headless engine "sees" in real-time.
  3. Automated Recovery: Our system monitors the health of the authentication bridge. If a handshake stalls or the WhatsApp WebSocket disconnects unexpectedly, the engine performs a "Warm Reset" to restore the link without losing your paired status.

🛡️ Strategic Best Practices for Developers

1. Hybrid Authentication Strategy

For the best User Experience (UX), we recommend implementing a hybrid approach in your application dashboard:

  • Default (QR Image): Provide the direct /v2/auth/qr-image for desktop users. It’s the fastest and most familiar way to link.
  • Advanced (Pairing Code): Offer the /v2/auth/request-code method as a primary option for mobile-to-mobile onboarding or users with broken cameras. This allows a user to simply copy an 8-digit code and paste it into their WhatsApp settings.

2. The "Trust but Verify" Security Model

Wawp adheres to a Zero-Secrets Policy. We do not log your API Access Tokens or WhatsApp Session Keys in our persistent application logs.

  • Developer Action: Ensure that your frontend never exposes the access_token in client-side logs. Always proxy authentication requests through your own backend to maintain a secure "Server-to-Server" relationship with Wawp.

3. Implementing "Live" UI Updates

WhatsApp QR codes are dynamic and expire every 20-30 seconds.

  • The Ideal Workflow: Use a WebSocket or a 5-second polling loop to refresh the QR image on your screen. If our API returns a 422 status, it signals that the engine is refreshing its state. Your UI should show a "Generating fresh code..." spinner rather than an error message.

⚖️ QR Code vs. Pairing Code: Which to Use?

ComparisonQR Code MethodPairing Code Method
User EffortScan with Camera (Fast)Manual Entry (Medium)
Supported DevicesAll (Standard)Modern Android/iOS
ReliabilityHighExtremely High (Headless)
Best ForWeb-based DashboardsCLI tools, VPS, Mobile Apps

🧪 Technical Flow & Deployment Logic

To build a professional onboarding flow, your orchestration logic should follow these steps:

  1. State Audit: Call /v2/session/info.
  2. Logic Branching:
    • if WORKING: Redirect user to their active dashboard.
    • if STOPPED: Call /v2/session/start and wait 5 seconds.
    • if SCAN_QR_CODE: The engine is ready for an identity link.
  3. Visual Presentation:
    • Fetch the latest image via /v2/auth/qr-image.
    • Render it in a responsive container with a 30-second countdown timer to manage user expectations.
  4. Verification: Poll /v2/session/info every 3 seconds. The moment the status transitions to WORKING, trigger a "Success" animation and fetch the account details via /v2/session/me.

⚠️ Common Pitfalls to Avoid

  • Token Exposure: Never append the access_token to a public URL that might be cached by CDNs or proxies. Use POST requests whenever possible.
  • Poll Flooding: Do not poll for authentication status faster than once every 2 seconds. Excessive requests can cause transient latency in the engine’s encryption handshake.

Summary of Capabilities:

  • Power a white-labeled "Connect WhatsApp" experience.
  • Choose between QR image, raw QR string, or Pairing codes.
  • Monitor session persistence with high-fidelity screenshots.
  • Leverage automatic background engine restarts for 99.9% pairing reliability.

Command Palette

Search for a command to run...