Save authentication that requires an interaction for interactions that require it (e.g., buying something, viewing personalized pages).
Supported approaches:
Base App natively supports SIWF in-app, enabling social identity without leaving the app. Quick Auth can issue a JWT to persist session state.User Experience in Base App:
Create Account Users (new Farcaster accounts created during Base App onboarding): Users see a “Login request” tray with the SIWF message and can sign it directly with their passkey
Connect Account Users (existing Farcaster accounts connected during onboarding): Users are prompted to deeplink to Farcaster one-time only to register their wallet as an auth address, then enjoy seamless in-app sign-in thereafter
import { useMiniKit, useAuthenticate } from '@coinbase/onchainkit/minikit';function MyComponent() { const { context } = useMiniKit(); const { user } = useAuthenticate(); // ✅ Safe: Use context for analytics only const userFid = context.user.fid; // For analytics tracking // ✅ Safe: Use cryptographic verification for auth const verifiedUser = user; // From SIWF or wallet auth // ❌ Unsafe: Don't rely on context for primary auth // const isAuthenticated = !!context.user.fid; // Can be spoofed! return ( <div> {/* Use verified user data for secure operations */} </div> );}