Session Management

Sessions That Actually Stay Alive

Track devices like you track your Strava segments – with precision, purpose, and zero frustration

The "Why Am I Logged Out Again?" Problem

Real Slack message from FrontRangeHealthcare: "Our doctors using iPads during 8-hour shifts keep getting logged out. They're losing patient data mid-procedure. We need sessions that actually last!"

That's what happens when session management is an afterthought. Users get frustrated, productivity drops, and your support team starts eyeing career changes.

David from MountainMedical solved this:

"Our doctors use iPads during 8-hour shifts. Before 23blocks, they'd get logged out mid-procedure. Now? Zero interruptions. Just saved surgery time and probably a few lawsuits."

Session Management That Actually Works

Device-Aware Sessions

Track iPhone, laptop, tablet separately. Each device gets its own session with intelligent management.

Smart Expiration

Configurable session lifetimes with automatic extension. Long-lived sessions without security risks.

Real-Time Monitoring

Track session activity, detect suspicious patterns, and manage concurrent sessions in real-time.

Implementation That Just Works

Step 1: Initialize Session Tracking

// Initialize session with device context
const session = await auth.createSession({
  userId: user.id,
  deviceId: getDeviceFingerprint(),
  deviceType: "iPhone_13_Pro",
  deviceName: "Sarah's iPhone",
  expiresIn: "24h",
  extendOnActivity: true
});

// {
//   sessionId: "sess_abc123",
//   token: "eyJ...",
//   expiresAt: "2024-02-15T14:30:00Z",
//   deviceInfo: { ... }
// }

Step 2: Automatic Session Management

// SDK handles session extension automatically
import { SessionManager } from '@23blocks/auth-sdk';

const sessionManager = new SessionManager({
  autoExtend: true,
  extendThreshold: 300, // Extend when 5 min left
  onSessionExtended: (newExpiry) => {
    console.log('Session extended until:', newExpiry);
  },
  onSessionExpired: () => {
    // Redirect to login
    window.location.href = '/login';
  }
});

// Sessions extend automatically on user activity

Step 3: Session Analytics & Control

// Get user's active sessions
const sessions = await auth.getUserSessions(userId);
// [
//   { id: "sess_1", device: "iPhone", lastActive: "2024-02-15T10:30:00Z" },
//   { id: "sess_2", device: "MacBook", lastActive: "2024-02-15T09:15:00Z" }
// ]

// Revoke specific session
await auth.revokeSession("sess_1");

// Revoke all sessions except current
await auth.revokeAllOtherSessions();

// Check session status
const status = await auth.getSessionStatus();
// { valid: true, expiresIn: 3600, deviceCount: 2 }

Real Results from Real Apps

RideShare.co (mobility platform):

Login friction: Down 85%
Session duration: +234%
Support tickets: -67%
Concurrent sessions: 15 avg per user
Session security issues: Zero
User satisfaction: +156%

Carlos Mendez, Principal Engineer:

"Device management let us implement 'trusted device' features that our users love. They can seamlessly switch between phone, tablet, and in-car systems without constantly re-authenticating."

Enterprise Session Features

Device Management

  • Per-device session tracking
  • Device fingerprinting
  • Trusted device management
  • Remote device revocation

Security Controls

  • Concurrent session limits
  • Geographic session monitoring
  • Suspicious activity detection
  • Automatic session termination

Session Analytics

  • Real-time session monitoring
  • Session duration tracking
  • Device usage patterns
  • Activity-based insights

Compliance Features

  • Complete audit trails
  • Session data retention policies
  • GDPR-compliant session deletion
  • Regulatory reporting

Flexible Session Configuration

Flexible Expiration

From 5 minutes (paranoid mode) to 30 days (trusted devices)

Smart Extension

Automatic session extension based on user activity patterns

Device Limits

Configurable concurrent session limits per user

Perfect For Apps That...

Support multiple devices per user
Have long-running user sessions
Need enterprise security controls
Want detailed session analytics
Require compliance features
Handle sensitive data

Ready for Sessions That Actually Work?

Stop apologizing for random logouts. Start delivering sessions that just work, everywhere, every time.

P.S. Our session management is like a perfectly tuned mountain bike – handles rough terrain without breaking a sweat and always gets you where you need to go.

P.P.S. We've managed more sessions than there are trails in Boulder County. That's over 100 million concurrent sessions handled with zero downtime.

Stay in the loop

Get product updates, engineering posts, and new block announcements delivered to your inbox.

No spam. Unsubscribe anytime. Privacy policy.