Authentication Flow - Clarified โ ¶
Date: November 24, 2025 Status: Simplified and working
๐ฏ The Problem¶
There was confusion in the UI with two different "Connect Wallet" buttons: 1. Old M2 auth system (email/password + wallet) 2. New M3 wallet integration (Solana on-chain)
This created a confusing user experience.
โ The Solution¶
Simplified to wallet-only authentication for on-chain operations.
What Changed¶
Before (Confusing):
Header:
- WalletConnectButton (for on-chain)
- Sign In button (for backend auth)
- Connect Wallet button (for backend auth)
After (Clear):
๐ Current Authentication Architecture¶
Two Separate Systems (Intentional)¶
1. Backend Auth (M2) - For Creator/Curator Features¶
Purpose: Account management for non-trading features
Location: stores/auth.ts
Used For:
- Creating market drafts
- Curator console access
- User profiles
- Market submissions
Methods: - Email/password login - JWT tokens - Session management
Status: Still available via AuthModal component (not in header currently)
2. Wallet Connection (M3) - For On-Chain Trading¶
Purpose: Solana blockchain interaction
Location: stores/wallet.ts
Used For:
- Trading on markets
- Signing transactions
- Adding/removing liquidity
- Claiming winnings
- All on-chain operations
Methods: - Phantom wallet - Solflare wallet - Direct blockchain connection
Status: โ Primary in header, fully functional
๐จ Updated UI Flow¶
Desktop Header¶
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ [Logo] Markets Create Curate Proofs โ
โ [Connect Wallet Button] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Mobile Header¶
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ [Logo] [Menu โก]โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
When menu open:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Markets โ
โ Create โ
โ Curate โ
โ Proofs โ
โ [Connect Wallet Button] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ง Implementation Details¶
What Was Removed from Header¶
Desktop: - โ Old "Sign in" button - โ Old "Connect Wallet" button (backend auth) - โ User profile link - โ Sign out button
Mobile: - โ Same items as desktop
What Remains in Header¶
Desktop & Mobile: - โ WalletConnectButton (Solana wallet) - โ WalletModal (wallet selection) - โ Navigation links
๐ User Journey¶
For Trading Users (Primary Flow)¶
- Visit site โ See "Connect Wallet" button
- Click button โ Wallet modal opens
- Select Phantom/Solflare โ Wallet extension opens
- Approve connection โ Wallet connected
- Trade on markets โ Sign transactions with wallet
No email/password required for trading!
For Creator/Curator Users (If Needed)¶
Backend auth (M2) is still available in the codebase if needed:
- stores/auth.ts - Auth store
- components/AuthModal.vue - Login/register modal
- Can be re-added to UI if needed for creator/curator features
Currently: Not shown in header (simplified for trading focus)
๐ฏ Design Philosophy¶
Why Wallet-Only in Header?¶
M3 Focus: On-chain trading is the primary feature Simplicity: One clear action for users Web3 Native: Wallet connection is standard in blockchain apps Future-Proof: All on-chain features use wallet connection
Backend Auth Still Available¶
The M2 auth system (stores/auth.ts) is still in the codebase and can be used:
- Programmatically in components
- Via AuthModal component
- For API endpoints that require backend auth
It's just not in the header UI right now.
๐ Future: Unified Auth (Optional)¶
If you want to unify both systems later:
Option 1: Wallet-First Auth¶
- User connects wallet
- Backend uses wallet address as identifier
- No separate email/password needed
- Sign messages to prove wallet ownership
Option 2: Dual Auth¶
- User can choose: Email/Password OR Wallet
- Both stored in backend
- Can link wallet to existing account
Option 3: Keep Separate (Current)¶
- Wallet for on-chain operations
- Backend auth for creator/curator features
- Two independent systems
Current choice: Option 3 (Keep Separate)
๐จ Code Changes Made¶
AppHeader.vue¶
Removed:
<!-- Old auth buttons -->
<template v-if="authStore.isAuthenticated">
<RouterLink to="/account" class="nav__link user-link">
{{ authStore.user?.username }}
</RouterLink>
<button class="ghost" @click="handleLogout">Sign out</button>
</template>
<template v-else>
<button class="ghost" @click="openAuthModal('login')">Sign in</button>
<button class="cta" @click="openAuthModal('register')">Connect Wallet</button>
</template>
<!-- Auth modal -->
<AuthModal :is-open="authModalOpen" />
Kept:
<!-- Wallet connection only -->
<div class="actions">
<WalletConnectButton />
</div>
<WalletModal />
Removed Imports:
Removed Functions:
function openAuthModal(mode: 'login' | 'register') { ... }
function closeAuthModal() { ... }
function handleAuthSuccess() { ... }
function handleLogout() { ... }
โ Result¶
Clear User Experience¶
- โ One "Connect Wallet" button
- โ No confusion about which wallet to use
- โ Clear on-chain focus
- โ Simplified navigation
Clean Code¶
- โ Removed unused auth modal logic from header
- โ Cleaner imports
- โ Fewer state variables
- โ Simpler component
Flexible Architecture¶
- โ Backend auth still available in codebase
- โ Can re-add auth UI if needed
- โ Wallet connection independent
- โ Both systems functional
๐งช Testing¶
Test the Simplified Flow¶
- Open http://localhost:5173
- See single "Connect Wallet" button in header
- Click button
- Modal opens with Phantom/Solflare options
- Connect wallet
- Verify address appears in header
- No confusion about email/password
Verify Backend Auth Still Works (If Needed)¶
If you need to use backend auth:
// In any component
import { useAuthStore } from '@/stores/auth';
const authStore = useAuthStore();
// Login programmatically
await authStore.login(email, password);
// Or show modal
import AuthModal from '@/components/AuthModal.vue';
// Add to template and control with v-if
๐ Comparison¶
Before (Confusing)¶
Actions:
1. Connect Wallet (Solana)
2. Sign In (Backend)
3. Connect Wallet (Backend) โ DUPLICATE!
4. User Profile
5. Sign Out
User thinks: "Which wallet? Why two buttons?"
After (Clear)¶
Actions:
1. Connect Wallet (Solana) โ SINGLE BUTTON!
User thinks: "Connect wallet to trade. Simple!"
๐ฏ When to Use Each System¶
Use Wallet Connection (M3) For:¶
- โ Trading on markets
- โ Adding liquidity
- โ Removing liquidity
- โ Claiming winnings
- โ Signing transactions
- โ All blockchain operations
Use Backend Auth (M2) For (If Needed):¶
- Creating market drafts via API
- Curator console access via API
- User profile management
- Non-blockchain features
Note: Currently, backend auth is NOT shown in UI but still available in code.
๐ Benefits¶
For Users¶
- โ Simpler: One button, clear purpose
- โ Faster: Direct wallet connection
- โ Standard: Matches other Web3 apps
- โ No confusion: Clear what to do
For Developers¶
- โ Cleaner code: Less complexity in header
- โ Flexible: Can re-add auth UI if needed
- โ Focused: M3 on-chain features first
- โ Maintainable: Separation of concerns
๐ Migration Notes¶
If You Need Backend Auth UI Back¶
-
Import AuthModal:
-
Add state:
-
Add buttons:
-
Add modal:
๐ Summary¶
Problem: Confusing dual auth with duplicate buttons Solution: Simplified to wallet-only in header Result: Clear, focused, Web3-native user experience
Backend auth: Still available, just not in header UI Wallet connection: Primary method for on-chain operations
Last Updated: November 24, 2025 Status: โ Simplified and working Dev Server: โ Live at http://localhost:5173 with changes