Auth Modal
Connect Modal

Web5 Auth Modal

Social-only wallet connect for Web5 Nexus dapps — Google / Apple / email (and more) through BYOK backends. One branded modal; no MetaMask aggregator.

@web5nexus/authmodal-react@0.3.8@web5nexus/authmodal-core@0.3.2

Why Auth Modal?

  • Social-first UX — users pick a method; you plug in Web3Auth, Magic, Privy, Particle, or Para
  • One session — EVM via ChainRouter or custom RPC; optional BTC Taproot/SegWit when the adapter exports a key (Web3Auth)
  • Host brandingtheme.appName, theme.logo, colors, layout — “Powered by Web5 Nexus” is always shown
  • Vite-ready — each adapter ships /vite helpers (see below)

For a Bitcoin-first product (solo modal, PSBT, Ordinals), use @web5nexus/authmodal-bitcoin instead of (or alongside) Connect Modal BTC derive.

Install

npm i @web5nexus/authmodal-react @web5nexus/authmodal-core \
  @web5nexus/authmodal-web3auth @web5nexus/authmodal-magic \
  @web5nexus/authmodal-privy @web5nexus/authmodal-particle @web5nexus/authmodal-para

Import styles once:

import '@web5nexus/authmodal-react/styles.css'

BYOK env

EnvPurpose
NEXT_PUBLIC_W3A_CLIENT_ID / VITE_W3A_CLIENT_IDWeb3Auth client id
NEXT_PUBLIC_MAGIC_API_KEY / VITE_MAGIC_API_KEYMagic publishable key
NEXT_PUBLIC_PRIVY_APP_IDPrivy app id
NEXT_PUBLIC_PARTICLE_*Particle project/client keys
NEXT_PUBLIC_PARA_API_KEYPara API key
NEXT_PUBLIC_CHAINROUTER_API_KEYOptional managed EVM RPC

End users never enter these keys. See Adapters for capability details.

Quick start

import '@web5nexus/authmodal-react/styles.css'
import { AuthModalProvider, ConnectButton } from '@web5nexus/authmodal-react'
import { web3auth } from '@web5nexus/authmodal-web3auth'
import { magic } from '@web5nexus/authmodal-magic'
import { privy } from '@web5nexus/authmodal-privy'
 
const adapters = [
  web3auth({ clientId: process.env.NEXT_PUBLIC_W3A_CLIENT_ID! }),
  magic({ apiKey: process.env.NEXT_PUBLIC_MAGIC_API_KEY! }),
  privy({ appId: process.env.NEXT_PUBLIC_PRIVY_APP_ID! }),
]
 
export default function App() {
  return (
    <AuthModalProvider
      adapters={adapters}
      chains={[1, 8453]}
      transport={{
        mode: 'chainrouter',
        apiKey: process.env.NEXT_PUBLIC_CHAINROUTER_API_KEY!,
        chainId: 1,
      }}
      bitcoin={{ enabled: true, network: 'mainnet', prefer: 'taproot' }}
      preferredAdapters={['web3auth', 'magic', 'privy']}
      theme={{
        mode: 'dark',
        layout: 'auto',
        size: 'md',
        accentColor: '#3DDC97',
        appName: 'My App',
        subtitle: 'Login to continue.',
        logo: 'https://example.com/logo.png',
      }}
    >
      <ConnectButton />
    </AuthModalProvider>
  )
}

Theme

FieldNotes
modelight | dark | auto
layoutwide | compact | solo | auto (1 adapter → solo; 2+ → wide / compact by viewport)
sizesm | md | lg — widths: solo 340/380/420; wide 380/520/720
accentColor / accentTextColorPrimary CTA colors
surfaceColor / textColor / mutedColor / borderColor / overlayColorOptional overrides
appName / logo / subtitleYour product brand
borderRadius / fontFamilyOptional

Layouts: solo is email + social icon row (single-provider chrome). wide / compact show the providers aside + full method list for the selected adapter. Preview every size in the Playground.

Not configurable: modal footer always shows “Powered by Web5 Nexus” (with logo) linking to web5.nexus. Fields title, showPoweredBy, and poweredByUrl are ignored.

Vite helpers

Import the Web3Auth polyfill first, then merge adapter Vite helpers (see the Auth Modal demo vite.config.ts):

import '@web5nexus/authmodal-web3auth/polyfill'
 
import {
  web3authOptimizeDeps,
  web3authProcessPolyfillPlugin,
  web3authViteAliases,
} from '@web5nexus/authmodal-web3auth/vite'
import { magicOptimizeDeps } from '@web5nexus/authmodal-magic/vite'
import { privyOptimizeDeps } from '@web5nexus/authmodal-privy/vite'
import particleWasmPlugin, { particleOptimizeDeps } from '@web5nexus/authmodal-particle/vite'
import { paraOptimizeDeps } from '@web5nexus/authmodal-para/vite'

Hooks

HookRole
useAccountaddress, user, connected, adapterId
useChainchainId, chains, setChain
useBitcoinp2tr / p2wpkh when BTC derive is enabled + key export
useConnect / useDisconnectProgrammatic connect / logout (no modal required)
useAuthModalClient + openModal

Custom login UI without ConnectButton: see Headless / custom UI (useConnect, createAuthModal, per-provider examples).

B2B CRM bridge (App pk_, Users, MAW): Marketing Hub (@web5nexus/authmodal-marketing).

Bitcoin via Connect Modal vs solo package

Connect Modal bitcoin: { enabled: true }@web5nexus/authmodal-bitcoin
UXAfter EVM social loginDedicated Bitcoin connect modal
Key sourceAdapter key export (Web3Auth)Web3Auth key export
Address typesPrefer taproot / segwit via coreTaproot, SegWit, Legacy, Nested SegWit
PSBT / Ordinals / RunesLimited / stubsFirst-class hooks

→ Full Bitcoin docs: Bitcoin Wallet

Try it

Loading Connect lab…

Also see the full Playground.