Sessions & Devices
Each time a user signs in, Tribe creates a session record that captures the browser, operating system, and device type. This makes it straightforward to build a device management page where users can see everywhere they’re logged in and revoke sessions they don’t recognize. Think of the “active sessions” panel in apps like GitHub or Google.
View active devices
Section titled “View active devices”import { Tribe } from "@tribecloud/sdk";
const devices = await tribe.getActiveDevices();// Returns: [{ id, browser, os, deviceType, lastActiveAt, createdAt, isCurrent }]Revoke a session
Section titled “Revoke a session”await tribe.revokeSession(sessionId);Log out everywhere
Section titled “Log out everywhere”await tribe.invalidateAllSessions();// All sessions are destroyed — user is logged out on every deviceDevice list UI (React)
Section titled “Device list UI (React)”function DeviceList() { const [devices, setDevices] = useState([]);
useEffect(() => { tribe.getActiveDevices().then(setDevices); }, []);
const revoke = async (id) => { await tribe.revokeSession(id); setDevices((d) => d.filter((dev) => dev.id !== id)); };
return ( <ul> {devices.map((d) => ( <li key={d.id}> {d.browser} on {d.os} ({d.deviceType}) {d.isCurrent ? " (this device)" : ( <button onClick={() => revoke(d.id)}>Revoke</button> )} </li> ))} </ul> );} Multi-Factor Recovery Give users multiple independent ways to recover their account so losing one login method doesn't mean losing everything.