License Key Manager


(Joe Buhlig) #1

As part of the Discourse League project, I needed a way to generate and validate license keys. Thus, another plugin was required. But I wanted it to be possible for others to integrate license keys into their plugins as well. So here we go:

I put together a full how to on the League site, but the gist of it is that you need to create a new product that is tied to a group of users. Any time someone is added to the group a license key is generated for them. If they are removed from the group, their key is disabled.

From your plugin, you make an HTTP request using the ID of the product and the license key of the user to get the status of the key. It’s up to you what you want to do with the response but I recommend saving the status to a hidden site setting. If you want to go even further, you can create a sidekiq job that re-validates on a daily basis. That will allow you to revoke access from your site.