Licensing API example?

The lack of complete examples for the licensing API makes it quite difficult to use. It has already been discussed in the forum how there used to be an example (that was really easy to hack though) that was removed some time ago. The example for individual methods has no context and doesn’t att all provide the information a complete plugin example would do.

As an example the days_remaning examples states:

ext_id = "4e215280-dd23-40c4-babb-b8a8dd29d5ee" ext_lic = Sketchup::Licensing.get_extension_license(ext_id) if ext_lic.days_remaining != 0 puts "The license will expire in #{ext_lic.days_remaining} days." end

Am I supposed to implement this myself and e.g. run it when the extension is loaded or is this information provided to the user in the Extension Manger or some other integrated part of SU? How am I supposed to figure this out?

This is the one piece of the API where you can’t do much experiments yourself since you can’t have licenses for your own extensions. Being able to read the code of an existing extension to understand how everything works in practice would be very useful.

I’ve noticed @ChrisFullmer has 3 example plugins in the Extension Warehouse (visible in the store) but the information pages for the individual extensions says access is denied. Would it be possible to have these published? Perhaps even live and unencrypted on the Extension Warehouse so you could see for yourself exactly what happens in SketchUp when e.g. a trial expires or a paid license expires.

2 Likes

Am I supposed to do anything if licensed? returns false? E.g. opening the extension’s page on the Extension Warehouse so the user can buy a license? Or does SketchUp do that itself?

Soon I’ll make a feature request for having the whole licensing API deprecated because in it’s current state there’s no reason for it to exist.

I’ve created my own API example/experiment and shared it at GitHub. If anyone has any comments on this implementation, please comment here or on GitHub.

Currently I use a somewhat dirty hack with an out of screen web dialog to open the Extension Warehouse page for the extension. If there is any other way to open the Extension Warehouse within SketchUp showing a specific extension, please let me know.

Your GitHub example does not appear to be stand alone as it needs a constant called “EXTENSION”. Is that supplied by Sketchup when you submit the rbz file for digital signature?

I always define that constant in the loader script to later be able to retrieve the name and other information: Sketchup-Api-Licensing-Test/ene_license_test.rb at master · Eneroth3/Sketchup-Api-Licensing-Test · GitHub .

Hi, what version will this API work on? 2015 and later? What happen for earlier versions?

I also understood from another thread Thomas mentioned an update will be available for easier generation of licenses for testing. Do we have any news on this yet?

I’m too tempted to make comments on code that I have not executed. I ran it and it worked of course. My copied version of extension registration uses the variable “ext”. Makes sense to use a constant inside your module.

The licensing example plugin is “registered” on my Sketchup 2017 in the sense that the extension manager recognizes it and allows the “main.rb” to run, adding to the extension menu. Although it is “registered”, it isn’t “licensed”, and its “id” method returns an empty string. Does Sketchup some how populate that string with unique ID text when the plugin is licensed?

MichaelW: I think the licensing API is 2015 and later. Earlier versions would in that case throw an error when the extension tries to make the licens checks. I’m usually coding for SU2016+ these days so I’m not that familiar with what happens in the old versions.

BruceYoung: I think the extension ID is created once the extension is uploaded to the Extension Warehouse. If you look in your plugin folder extensions from the Extension Warehouse should have a text file added to them containing this ID. However I have no idea what prevents users from buying a 3 USD extension and copy the extension ID file into the directory of a 60 USD extension to make it run on the same license. The whole licensing system isn’t transparent at all and even this example code is much built on guesses of how the API is expected to be used.

that’s sort of the point of licensing systems and encryption…

the more that know, the less useful they become…

however, registered developers could be be issued with keys for the various levels and a mechanism that kicks in if exceeded…

ideally I could authorise 10 alpha/beta licences and be notified if an 11th user tried to use it…

it shouldn’t matter if it’s all the same extension or 10 different ones…

if it wasn’t me sending too many in error, all would be invalidated, I would receive a new key to re-issue…

else they would run to their predetermined allocation…

john

Not at all. Security through obscurity is no real security at all.

This topic was automatically closed after 91 days. New replies are no longer allowed.