Overview
The Session Management section provides real-time visibility into user sessions and linked accounts. Track active sessions, monitor login activity, view IP addresses with geolocation, and manage OAuth account connections.Accessing Sessions
Navigate to Sessions from the main sidebar to view session management dashboard.Key Features
Session List View
The sessions page displays:- Total session count - All sessions in your system
- Session table - Session ID, user, IP address, location, and status
- Session status - Active or Expired indicators
- Expiration dates - When each session expires
- IP address tracking - Source IP for each session
- Geographic location - City, region, and country (with flag emoji)
- Pagination - Browse through all sessions
Session Details
Each session shows:- Session ID - Unique identifier (copyable)
- User ID - Associated user (copyable)
- IP Address - Client IP with geolocation lookup
- Location - City, Region, Country with flag
- Status - Active (green) or Expired (red)
- Created At - Session start time
- Updated At - Last session update
- Expires At - Session expiration timestamp
Session Workflows
View Active Sessions
- Navigate to Sessions page
- Use the status filter to show only “Active” sessions
- See all currently authenticated users
- Sort by expiration date to find sessions expiring soon
View Session Details
- Click the View icon (eye) on any session
- Modal opens with full session information:
- Session ID and User ID (both copyable)
- IP address and resolved location
- Creation, update, and expiration timestamps
- Copy IDs for reference or debugging
Delete Session (Logout User)
- Find the session you want to terminate
- Click Delete icon (trash) in actions column
- Confirm deletion
- Session is immediately invalidated
- User is logged out on their next request
Search and Filters
Search
Search sessions by:- Session ID (partial match)
- User ID (partial match)
Session Status Filter
Filter sessions by status:All Sessions
All Sessions
Shows every session regardless of expiration status
Active Sessions
Active Sessions
Only sessions with
expiresAt in the future:- Currently valid sessions
- Users who can access your app
- Sessions that haven’t been manually revoked
Expired Sessions
Expired Sessions
Sessions that have passed their expiration:
- No longer valid for authentication
- User must log in again
- Historical session data
IP Geolocation
Better Auth Studio can resolve IP addresses to geographic locations:Configuration
Enable IP geolocation in yourstudio.config.ts:
Supported Providers
IPInfo
Provider: Get API token: ipinfo.io
ipinfoEndpoints:lite- Basic location data (default)lookup- Full location details
IP-API
Provider: Learn more: ip-api.com
ipapiFeatures:- Free tier available
- No API token required
- Rate-limited on free tier
Location Data
When configured, sessions show:- City - e.g., “San Francisco”
- Region - e.g., “California”
- Country - e.g., “United States”
- Country Code - e.g., “US”
- Flag Emoji - Visual country indicator
Location resolution happens in real-time. If you see “Resolving…”, geolocation is in progress.
Account Management
View and manage linked OAuth accounts:Viewing Accounts
The Sessions page includes an accounts seeding feature:Account Types
Linked accounts can be:- OAuth Providers - GitHub, Google, Discord, etc.
- Email/Password - Credential-based accounts
- Phone Number - SMS-based authentication
Session Lifecycle
Session Creation
Sessions are created when:- User signs in with email/password
- User authenticates via OAuth provider
- User verifies magic link
- Programmatic session creation via API
Session Expiration
Sessions expire:- After the configured
expiresAttime - When manually deleted from Studio
- When user explicitly logs out
- When session is revoked programmatically
Session Updates
TheupdatedAt field changes when:
- Session is refreshed
- Session metadata is updated
- User performs authenticated actions
Bulk Operations
Seed Sessions
Create test sessions for development:Session Monitoring
Active Session Count
Monitor how many users are currently authenticated:- View total session count in page header
- Filter to “Active” sessions
- Compare to total users to see engagement
Session Analytics
Use session data to understand:- Peak usage times - When users are most active
- Session duration - How long users stay logged in
- Geographic distribution - Where your users are located
- Login frequency - How often users authenticate
Best Practices
Monitor Active Sessions
Regularly review active sessions to:
- Detect unusual login patterns
- Identify suspicious IP addresses
- Track concurrent sessions per user
Configure IP Geolocation
Enable IP tracking to:
- Identify login locations
- Detect potential account takeovers
- Understand user demographics
Security Considerations
Session Security
- Revoke suspicious sessions - Delete sessions from unusual IPs
- Monitor concurrent sessions - Check if user has multiple active sessions
- Geographic anomalies - Investigate sessions from unexpected locations
- Session hijacking - Watch for rapid IP changes within same session
IP Address Privacy
- IP addresses are sensitive personal data
- Comply with GDPR, CCPA, and privacy regulations
- Only store IPs when necessary
- Consider anonymizing or hashing IPs in production
Troubleshooting
Location shows 'Resolving...' forever
Location shows 'Resolving...' forever
Check your IP geolocation configuration:
- Verify
ipAddressconfig instudio.config.ts - Ensure API token is valid (for IPInfo)
- Check API rate limits
- Verify network connectivity to provider
Sessions not appearing
Sessions not appearing
- Verify users have actually logged in
- Check session expiration settings
- Ensure session creation is working in Better Auth
- Look for errors in browser console
Cannot delete sessions
Cannot delete sessions
- Check database permissions
- Ensure Better Auth adapter is configured correctly
- Verify session ID is correct
IP address not showing
IP address not showing
- IP tracking requires session creation to capture IP
- Check if Better Auth is configured to store IP addresses
- Verify request headers include IP information
API Reference
Session operations use these endpoints:GET /api/sessions- List all sessionsPOST /api/sessions- Create session (not typically used directly)DELETE /api/sessions/:id- Delete/revoke sessionPOST /api/seed/sessions- Seed test sessionsPOST /api/seed/accounts- Seed linked accountsPOST /api/geo/resolve- Resolve IP to location
Related Features
- User Management - Manage users who own these sessions
- Event Tracking - See login events that created sessions
- Developer Tools - Test OAuth flows that create sessions