Last updatedJun 6, 2019

Cloud app licensing

Any app intended for sale on the Atlassian Marketplace must have licensing features implemented. The licensing features control the use of the app in the Atlassian product.

In the Atlassian product, the Universal Plugin Manager (UPM) serves as the enforcement point that checks the validity of app licenses. The Atlassian product reports the licensing status of the instance to the app in each request. The UPM provides an API that apps use to access the Atlassian licensing system for its license checks.

The app should:

  • check the license status in service requests it receives from the Atlassian site
  • implement the logic appropriate for the given license status. For instance, for an inactive license, the app may choose to disable its features, enter a read-only state, or function in some other restricted manner that makes sense

Development considerations

In a nutshell, to implement licensing for Atlassian Connect, you need to:

  • set the enableLicensing flag in the app descriptor for the app
  • write code to check the lic URL parameter for all incoming requests
  • use the Atlassian Connect REST resource /addons/{appKey} to get additional license information for each application
  • implement the logic appropriate for the app based on the license status
  • use a private listing with access tokens to test all license statuses in a Cloud instance

The result of a license check by the Atlassian application is cached for 5 minutes.

Enabling app licensing

To implement licensing in an app, set the enableLicensing flag in the app descriptor file (atlassian-connect.json) to true. Any app intended for sale should have this flag enabled.

1
2
3
4
5
6
7
{
    "name": "Hello World",
    "key": "hello-world",
    "description": "Atlassian Connect app",
    "baseUrl": "http://www.example.com",
    "enableLicensing": true
}

This tells UPM to check and report licensing status to the app. On the other hand, if you are using a app strictly for internal use or you plan to distribute it freely on the Marketplace, this should be set to false.

Handling requests with the license status

Each incoming request from the Atlassian product site includes a query parameter named lic.

1
http://....?lic=active

Your app should check this value to determine the license status of the site associated with the current request. The lic parameter may have either of the following values:

  • active: the license is valid for this instance and app
  • none: no license is present

Accessing license details

In addition to the lic parameter, an app can use the REST API resource /addons/{appKey} provided by Atlassian Connect to get an instance's license for this app. Note, you will need to declare READ scope in order to use this resource.

Testing license enforcement

You can test licensing-related behavior of your app in a local, development environment to an extent. But there's no way to replicate the interaction with the UPM and Atlassian Marketplace in a local environment alone. In the production environment, the Atlassian Marketplace serves licenses for new subscribers, and the application interacts with the Marketplace to get the license state.

Installing your app in a cloud instance using an access token allows instance administrators to modify the license status of the app. This enables you to ensure that your app functions properly in all license statuses.