Skip to content

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):

Header:
  - WalletConnectButton (single button for Solana wallet)


๐Ÿ”„ 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)

  1. Visit site โ†’ See "Connect Wallet" button
  2. Click button โ†’ Wallet modal opens
  3. Select Phantom/Solflare โ†’ Wallet extension opens
  4. Approve connection โ†’ Wallet connected
  5. 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

  1. User connects wallet
  2. Backend uses wallet address as identifier
  3. No separate email/password needed
  4. Sign messages to prove wallet ownership

Option 2: Dual Auth

  1. User can choose: Email/Password OR Wallet
  2. Both stored in backend
  3. Can link wallet to existing account

Option 3: Keep Separate (Current)

  1. Wallet for on-chain operations
  2. Backend auth for creator/curator features
  3. 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:

import { useAuthStore } from '@/stores/auth';
import AuthModal from './AuthModal.vue';

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

  1. Open http://localhost:5173
  2. See single "Connect Wallet" button in header
  3. Click button
  4. Modal opens with Phantom/Solflare options
  5. Connect wallet
  6. Verify address appears in header
  7. 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

  1. Import AuthModal:

    import AuthModal from './AuthModal.vue';
    import { useAuthStore } from '@/stores/auth';
    

  2. Add state:

    const authStore = useAuthStore();
    const authModalOpen = ref(false);
    const authMode = ref<'login' | 'register'>('login');
    

  3. Add buttons:

    <template v-else>
      <button class="ghost" @click="openAuthModal('login')">Sign in</button>
    </template>
    

  4. Add modal:

    <AuthModal :is-open="authModalOpen" :initial-mode="authMode" />
    


๐ŸŽ‰ 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