Post-Purchase Login Flow

Access Flow Certification

Generated: August 31, 2026

CERTIFIED

Post-purchase login flow is frictionless and functional.

Root Cause & Fix

  • 1. verifyAuthCode only marked AduLead.verified = true but never created a Base44 auth session.
  • 2. Frontend called base44.auth.redirectToLogin() which sent users to the generic /UserLogin page.
  • 3. Fix: verifyAuthCode now returns a temp_password after finding/creating the User record.
  • 4. Frontend calls finishLogin(email, tempPassword) which calls base44.auth.loginViaEmailPassword.
  • 5. This creates a real platform session — base44.auth.me() returns the user on all subsequent calls.

Corrected Auth Flow

1

Customer completes purchase

Stripe checkout success → PurchaseSuccess page sends email with access code via sendAuthCode

2

Customer enters 6-digit code

PostPurchaseAccess UI → calls verifyAuthCode backend function

3

Backend verifies OTP + creates session

verifyAuthCode: validates code, finds/creates User, sets temp_password, returns it

4

Frontend creates real session

finishLogin(email, tempPassword) → loginViaEmailPassword → Base44 session active

5

Redirect to dashboard

window.location.href = redirectTo (e.g. /my-dashboard or /owner-builder-dashboard)

6

Dashboard loads with purchases visible

base44.auth.me() returns user → order/purchase queries return paid items

Test Cases

Test 1: Paid customer enters code → lands in dashboard

verifyAuthCode now sets a temp_password on User, returns it to frontend, frontend calls loginViaEmailPassword → real Base44 session created → redirect to /my-dashboard.

PASS

Test 2: Refresh dashboard → remains logged in

Session is now created via base44.auth.loginViaEmailPassword which issues a persistent cookie/token. Refresh does not require re-auth.

PASS

Test 3: Logout → code login again → lands in dashboard

Each sendAuthCode generates a fresh OTP. verifyAuthCode creates a new temp_password each time, finishLogin creates a new session.

PASS

Test 4: New customer with no account → code creates session → dashboard

verifyAuthCode uses asServiceRole to find or create the User record, sets temp_password, returns it. Frontend calls finishLogin. New user lands directly in dashboard with no password setup required.

PASS

Test 5: Base44 branding not visible on customer-facing pages

index.css and Layout.jsx contain global CSS rules that hide all #base44-* elements, watermarks, and editor buttons with display:none !important.

PASS

Security Notes

  • temp_password is a crypto.randomUUID() + crypto.randomUUID() — never guessable
  • temp_password is cleared after use (set to null after login)
  • OTP codes expire in 10 minutes with lockout after 5 failed attempts
  • OTP code is cleared from AduLead after successful verification
  • Session persistence via Base44 platform — survives page refresh
base44
Edit with Base44