SDK v7.x · Last verified March 2026 · iOS · Android · Web · Flutter
Speed run — just the code
Speed run — just the code
Prerequisites: SDK installed → SDK Setup, plus an API key from the social.plus console. Production apps also need a backend server to generate auth tokens.
After completing this guide you’ll have:
- Visitor mode enabled so unauthenticated users can browse content
- A smooth visitor → authenticated transition with session continuity
- Profile setup step (display name, avatar) at first login
Quick Start: Login as Visitor
Let users browse your app without creating an account:TypeScript
Step-by-Step Implementation
Initialize the SDK
Create the client once at app startup. This must happen before any login call.Full reference → Authentication
TypeScript
Login as a visitor (anonymous browsing)
Visitors get read-only access — they can view feeds, communities, and profiles but cannot post, comment, react, or follow. The SDK skips MQTT connections and push notification registration for visitors, saving resources.Full reference → Visitor Mode
TypeScript
Detect user type and gate write actions
Check the current user type before allowing write operations. Show a signup prompt when visitors try to interact.Full reference → Visitor Mode
TypeScript
Login with authentication
After the user signs up or logs in through your auth system, call the authenticated login. In production, always pass an Full reference → Authentication
authToken generated by your backend.TypeScript
Observe session state changes
Monitor the session lifecycle to show the right UI: loading spinner during Full reference → Authentication
establishing, navigate to app on established, re-auth prompt on tokenExpired.TypeScript
Set up the user profile
After first login, let users set their display name, bio, and avatar. The SDK auto-creates the user record on first login — this step updates it.Full reference → Update User Information
TypeScript
Implement session handler for token refresh
In production, tokens expire. The session handler lets the SDK request a fresh token from your backend without interrupting the user.Full reference → Authentication
TypeScript
Secure logout
Always call Full reference → Authentication
secureLogout() when the user logs out. This clears the session, stops real-time connections, and unregisters push tokens.TypeScript
Connect to Moderation & Analytics
Visitor analytics
Visitor analytics
Track how many visitors browse vs. convert to authenticated users. Visitor device IDs are available via
client.getVisitorDeviceId() for analytics attribution.Bot mode for SEO
Bot mode for SEO
Use
Client.loginAsBot() for search engine crawlers to index public content. Bots have even more restricted permissions than visitors — they can only read, never interact.→ Visitor Mode — Bot UsersWebhook: user created
Webhook: user created
Receive a
user.created webhook event when a visitor converts to an authenticated user (first login). Use this to trigger welcome emails or onboarding flows.→ Webhook EventsCommon Mistakes
Best Practices
Conversion funnel
Conversion funnel
- Show a subtle “Sign up for full access” banner while visitors browse — don’t block the experience
- Track which actions visitors attempt most (post, react, comment) to optimize your signup prompt placement
- Pre-fill the display name from your auth provider so users don’t have to type it twice
- Gate write actions at the UI layer (disable buttons) rather than catching SDK errors
Security
Security
- Never ship without auth tokens in production — without them, anyone can impersonate any
userId - Use
secureLogout()on every logout path (manual logout, session expiry, account deletion) - Implement the session handler — without it, sessions will fail silently when tokens expire
- Store auth tokens server-side and pass them to the client at login time; never generate tokens client-side
Performance
Performance
- Visitors skip MQTT connections and push notification registration automatically — no extra optimization needed
- Cache the user type check result per session;
getCurrentUserType()is synchronous and fast - For SSR/SEO, use bot mode to pre-render public content without consuming authenticated user slots
Next Steps
Your next step → Build a Social Feed
Users can sign in — now give them a feed full of content to explore.
User Profiles & Social Graph
Build the profile page your new users land on
Build a Social Feed
Show the feed that visitors browse before signing up
Notifications & Engagement
Set up push notifications after first login