Testing cloud addon licensing

I begin to test the licensing lifecycle in dev environment. The access token is created and app is installed via Marketplace with private listing.

When I make request in Postman with the API bellow:
Get/rest/atlassian-connect/1/addons/{appKey}
I get the response

 "license": {
        "active": true,
        "type": "DEVELOPER",
        "evaluation": true
    },

What means the type: “DEVELOPER”?
Also another concern. In the atlassian-connect.json file I added “?lic=active” code like shown bellow:

 "configurePage": {
            "key": "config-page",
            "url": "/render/config?lic=active",
            "name": {
              "value": "Configuration page"
            }
          }   

Is this enough, or maybe the “?lic=active” should be placed on other places in the code, and should I made some specific testing about this parameter ?lic=active

The reason the type is set to DEVELOPER is because you are using a private listing token. You can ignore this.

The lic=active should not be added to the descriptor manually. This will be added by Atlassian automatically and will either be lic=active or lic=none based on the current license state. Adding is manually will result in 2 query parameters, potentially creating ?lic=active&lic=none upon request.

2 Likes

In general, the lic=active coming from Atlassian should be good enough to implement license checking in your app. The app should work when lic=active and should disable features & show a warning if lic=none (or even better, if lic!=active).

If you want a more advanced user interaction, you can change the experience based on the state of active and evaluation fields that you got from the API. You can test this by going to the “Manage apps” section, select your app, and change the drop down select box with the license states.

1 Like

Thank you @remie for the quick response.

What confused me is the documentation, where the second line says: write code to check the lic URL parameter:

What and where should I write the mentioned code for checking lic URL parameter for the incoming requests?

The idea is that you use this query parameter either in your client-side code, your server-side template or your REST API endpoints (for instance, when processing webhooks). Based on the value of the parameter, you show the user a warning.

For instance, we use this sequence in our client-side code:

import qs from 'query-string';
...
const { lic } = qs.parse(window.location.search);
...
const [ isValidLicense ] = useState<boolean>(!isProduction || !isLicensingEnabled || lic === 'active');
...
if (!isValidLicense) {
   // Do something to show the user their license is invalid
}
1 Like

Is it correct to write in the atlassian-connect.json file this condition only?

"conditions": [
        {
            "condition": "addon_is_licensed"
        },

The conditions section of the descriptor will only affect the UI elements that are shown in Jira. Adding that will make sure that the module (i.e. menu item, panel, etc) will be visible.

However, it does not prevent other parts of the system, for instance webhooks, or the ability to circumvent the lack of UI integration if you know the direct path to your page in. It is therefor still recommended to add checks for the existence of lic=active.

1 Like

Hi Team,
I’m new to the Cloud development , is there any document on how to handle license management for the plug-in and any example that can help me