# Multiple license users on the same device

## Overview

When using **user-based** licenses, a user should be assigned per device due to limitations in our database model. For scenarios involving multiple users sharing devices, we recommend using a naming convention for HWIDs — for example, adding a suffix/prefix like `station_hwid_user1`. When a user operates locally, they can override the HWID with something like `local_hwid_user1`. When a user has `max_activations = 1` this will lead to the user using either `station_hwid_user1` or `local_hwid_user1`. This ensures that each HWID is uniquely associated with a single license user, preventing conflicts when multiple users (with different emails) are using the same machine.

The current flow is flawed because it relies on the hardware ID as the source of truth instead of the license user, which can lead to incorrect activation tracking and conflicts across shared devices. If your business logic uses hardware\_id for additional checks be sure to always add the suffix/prefix.

{% hint style="info" %}
Use a deterministic scheme that includes the username (or user identifier) in the HWID so each license user maps to a unique hardware identifier even on shared devices.
{% endhint %}

## Platform

Create a user based license and assign license users to the license.

![](/files/83a6d07153192100727d9f91f8b8d414495329f9)

## SDK flow

To support hardware ID overwrites, the system must use the `HardwareID` algorithm in combination with the username. In this example, we append the username as a suffix to the hardware ID:

{% code title="example.cpp" %}

```cpp
config->setHardwareID(getHardwareId() + "_" + username);
```

{% endcode %}

### Example Scenario

We enforce a rule where **each license user is allowed only one activation**, but **a single device can host multiple license users simultaneously**.

Example flows:

* User `t@t.com` activates their license on a local machine. This should:
  * Increment the license’s total activation count by **1**.
  * Increment **that license user’s** total activation count by **1**.
  * Assign the computed hardware ID as:
    * `local_machine_hwid_t@t.com`
* Two users `t@t1.com` and `t@t2.com` sharing the same **station machine** under the same license will get distinct HWIDs:
  * `station_machine_hwid_t@t1.com`
  * `station_machine_hwid_t@t2.com`

This approach ensures that each **license user has a unique hardware ID**, even if they share the same physical device. As a result, **license user-based activation tracking remains unambiguous**, avoiding any inflated or deflated `total_activation` counts.

![](/files/d99ca43f8be7979c310531af58b7749fcd38e5b2)

### Switching Machines

{% stepper %}
{% step %}

### Deactivate on the previous machine

User `t@t1.com` must deactivate the license on the station machine before moving.
{% endstep %}

{% step %}

### Activate on the new machine

User `t@t1.com` then activates the license on the local machine.
{% endstep %}
{% endstepper %}

![](/files/01c8a2f8b4acfddb1d2ae78a11d03e3c9f9fdef3)

The same rule applies when switching in the opposite direction — deactivate on the current machine, then activate on the target machine.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.licensespring.com/common-scenarios/multiple-license-users-on-the-same-device.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
