Detection Modes
Dfence supports two detection modes to suit different use cases: concurrence or device-limit. Select the mode that best suits your business needs.
Concurrence Mode
Concurrence mode detects when the same account is accessed from multiple devices or browser sessions simultaneously. This mode is ideal for enforcing strict single-device policies, preventing real-time account sharing, and protecting revenue by ensuring only one active session per user at any given moment.
When concurrent access is detected, Dfence immediately identifies the conflict and blocks unauthorized sessions, providing instant feedback to users within seconds.
How Concurrence mode Works
Here's a step-by-step example of what happens when account sharing is detected:
- User A logs in and starts a session with account
1234on their device - User B (or User A on a different device) attempts to access the same account
1234while User A's session is still active - Dfence detects the concurrent access and immediately blocks one of the sessions
- The blocked user sees a notification explaining that concurrent access has been detected

Note: When concurrent access is detected, Dfence determines which session to block based on the detection logic. The blocked session will automatically unblock once the other session ends.
Configuration
Concurrence mode is the default detection mode, but you can explicitly set it in your SDK configuration:
dfence.load('YOUR_TOKEN', { userId: 'THE_USER_ID', mode: 'concurrence', limit: 1 // See limit behavior below });
Limit Behavior
The limit parameter controls how many concurrent sessions are allowed per day:
limit: 1(default): Strict single-session policy - blocks immediately when a second session is detectedlimit > 1: Allows multiple concurrent sessions up to the specified limit. Once the limit is reached, additional sessions are blocked
Example: With limit: 2, a user can have two simultaneous sessions detected, but a third concurrent session will be blocked.
Device Limit Mode
Device limit mode enforces a maximum number of devices that can be active for a user simultaneously. Unlike concurrence mode which focuses on simultaneous sessions, device limit mode tracks and limits the number of unique devices that can access an account.
This mode is ideal for subscription tiers with device-based restrictions, family plans that allow multiple devices, and enterprise accounts that need flexible device limits. It's perfect for business models where you want to allow multiple devices but need to cap the total number to prevent abuse.
When a user tries to access their account from a device that exceeds the allowed limit, Dfence immediately blocks access and notifies the user that their device limit has been reached.
How Device Limit Mode Works
Here's a step-by-step example of what happens when device limits are enforced:
- User A logs in on their laptop (Device 1) with account
1234and starts a session - User A then logs in on their phone (Device 2) with the same account
1234- access is allowed (within limit) - User B tries to log in on a tablet (Device 3) with account
1234- if the limit is set to 2 devices, Dfence detects the limit has been reached - The third device is blocked and the user sees a notification explaining that their device limit has been exceeded

Note: Device limit mode tracks unique devices based on device IDs. If a user logs out from one device, that device slot becomes available for a new device. The limit applies to the number of active devices simultaneously, not the total number of devices that have ever accessed the account.
Config
To use device limit mode, set the mode parameter to 'device-limit' in your SDK configuration:
dfence.load('YOUR_TOKEN', { userId: 'THE_USER_ID', mode: 'device-limit', limit: 3 // Allow up to 3 devices simultaneously });
Limit
The limit parameter controls how many unique devices can be active for a user at the same time:
limit: 1: Single device only - blocks immediately if a user tries to access from a second devicelimit > 1: Allows up to N devices simultaneously. Once the limit is reached, any additional device attempting to access the account will be blocked
Example: With limit: 3, a user can access their account from three different devices (e.g., laptop, phone, tablet) at the same time. If they try to log in from a fourth device, that device will be blocked until one of the existing devices logs out or becomes inactive.