# Releasing an Identity-Based License

An end user who is assigned a device-based license is typically granted the right to access that license from two or more machines, but only from a single machine at any given time.

The user may face a situation in which they access their license from one machine (for example, their office machine) but fail to close the application's session. If they later attempt to access their license from a different machine (for example, their home machine), the login to the license will fail and return the status code HASP_IDENTITY_SHARING_VIOLATION.

You can provide users with the option to release their license from the original session and assign it to the new session. Modify the protected application as follows:

1.To log in to the Feature, the application should call LoginScope using the following scope:

    <?xml version="1.0" encoding="UTF-8" ?>
    <haspscope>
       <feature occupy_cloud_session="1" />
    </haspscope>

2.The application should call any of the following functions once every five minutes: Encrypt, Decrypt, Read, Write. If the function returns the status code HASP_CLOUD_SESSION_OCCUPIED_REMOTELY, the application knows that a user is attempting to access their license from a different machine. In this case, the application should exit, and thus release the license.

3.The application should log out from the Feature when the user quits the application.

If the user forgets to close an application on one machine and attempts to start the application on a different machine:

1.The application on the second machine does not start executing.

2.After a maximum of five minutes, the application on the first machine will call one of the methods listed above and then shut itself down.

3.The license is now reassigned to the application on the second machine, and the application can start to execute.

NOTE This technique is not applicable when working with detached licenses (whether working with automatic detaching or on-demand detaching).

Refer to Using XML Tags to Define Scope for additional information about creating Scope templates using XML tags.

## Related Topics

About XML Tags

Format XML Tags