Global Accounts Introduction
B3 Global Accounts provide seamless authentication and user management across the B3 ecosystem
B3 Global Accounts are deprecated. Upside and AnySpend now sign in with your own wallet. If you held funds in a Global Account and need help, ask in the B3 Discord. The team never DMs first and will never ask for your seed phrase or private key.
What are B3 Global Accounts?
B3 Global Accounts are a unified authentication system that provides users with a single identity across the entire B3 ecosystem. Users can authenticate once and access all B3 applications, games, and services seamlessly.
Key Features
Architecture
The Global Accounts system consists of several key components:
Authentication Flow
- Social Login: Users authenticate with their preferred social provider
- Account Creation: A B3 Global Account is created or linked
- Session Keys: Optional session keys for enhanced security
- Permissions: Granular permissions for different actions
React Components
B3Provider: Context provider for Global AccountsSignInWithB3: Complete authentication flowRequestPermissionsButton: Permission managementAccountAssets: Display user assets
Headless Services
- Authentication service for custom implementations
- Session management utilities
- Permission validation helpers
Quick Start
Basic Authentication
tsximport { B3Provider, SignInWithB3 } from "@b3dotfun/sdk/global-account/react";const baseChain = { id: 8453, name: "Base", nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, rpc: "YOUR_BASE_RPC_URL",};function App() { return ( <B3Provider theme="light" environment="production" partnerId="your-awesome-partner-id"> <SignInWithB3 strategies={["google"]} chain={baseChain} partnerId="your-partner-id" onLoginSuccess={(globalAccount) => { console.log("User authenticated:", globalAccount); }} /> </B3Provider> );}
Check Authentication Status
useAccountWallet returns an address only while the user is signed in.
tsximport { useAccountWallet } from "@b3dotfun/sdk/global-account/react";function UserProfile() { const { address, ensName } = useAccountWallet(); return ( <div> {address ? ( <p>Welcome, {ensName ?? address}!</p> ) : ( <p>Please sign in</p> )} </div> );}
Environment Configuration
Set up your environment variables:
bash# ProductionNEXT_PUBLIC_B3_API=https://api.b3.fun# DevelopmentNEXT_PUBLIC_B3_API=https://dev-api.b3.fun