License information in Forge backend

Licensing information can be found in the front-end of Forge using the getContext API (although it is recognized as “unsafe” per the App context security page).

Here is what I have so far;

  1. You can check to see if the license is active or not through a resolver’s context variable (example here)
  2. Free apps and apps that are not in production do not have license information in their context (from here)
  3. As opposed to the front-end’s license information, there is no documentation I could find on the structure of a license object from a backend context. I would have expected to find something here for instance.

Because I cannot test licensing in development and releasing my app “free” won’t get me any farther, can any one share the structure of the license object in Custom UI Resolvers?

Side question; does the object contain information in regards to the type of license if the app uses App Editions?

Thank you

hi,

you will find a lot of snippets in this thread:

And for custom UI resolver the only needed property is isActive=true.
So it will look like this:

    context: {
        accountId: string;
        localId: string;
        cloudId: string;
        // ...
        license?: {
                isActive: boolean;
        }
    };


...


    let isLicenseValid = context && context.license && context.license.isActive === true;

I am showing a banner if license is not active.

<div>
   {(context.license === null || context.license.active == false ) && 
      <Banner appearance="warning" icon={<WarningIcon label="" secondaryColor="inherit" />}>
         Some warning message...
      </Banner>
   }
</div>

Hi,

Thank you for the reply. I’ve already went through the “Silent breaking change” and I am watching it closely.

Since the discussions were laser-focused on isActive, I was kind of hoping it was only because the discussion didn’t extend to the rest of the parameters under the license object.

In any case, thank you for confirming there are no other properties next to the isActive boolean. I hoped there would be more information on the license, like what is provided to the front-end.

I would simply like to add that to your point; “The only needed property…” I must disagree. To me having more/better information on the license in the backend would be a lot more helpful than a simple boolean.

Kind regards,

1 Like

Hi,

Thank you for the snippet. I was inquiring to know if there was more information in the license object aside the active or isActive booleans in the backend.

Kind regards,