Consumer Identity Management
The Fanfare SDK supports multiple authentication methods to identify consumers. Theauth module handles session creation, OTP verification, and session management.
Authentication Methods
Guest Sessions
Guest sessions allow consumers to participate without providing identifying information. Guest sessions are device-bound.Email OTP Authentication
Email-based OTP provides verified consumer identity:Phone OTP Authentication
Phone-based OTP for SMS verification:External Exchange
Exchange a one-time code from an external authentication system:Type Definitions
Session Types
AuthStatus
OTP Request/Verify
Auth Module API
check()
Returns the current authentication status (synchronous).guest()
Creates a new guest session.requestOtp()
Sends an OTP to the provided email or phone.options- Email/phone and optional name, or just an email string
verifyOtp()
Verifies the OTP and creates an authenticated session.options- Email/phone with the verification code
exchangeExternal()
Exchanges an external authentication code for a session.login()
Combined OTP flow (sends code to email).logout()
Ends the current session.getSession()
Returns the current session or null.refresh()
Refreshes the access token.Authentication Events
Subscribe to authentication events:Session Persistence
By default, sessions are persisted tolocalStorage: