Using JWT as a license key in Google Apps Script Google Workspace Add-ons

Image credit: Zzapps

Many developers want to offer specific, additional functionality for specific users. One very common scenario is to differenciate in users that pay for this functionality.

When you deliver an add-on, you want to know whether this user has this special access. We know this as a license.

In this blog, I will show you how we can let the add-on know what the user’s license is. We are going to do this by giving the user a key, where they can ‘unlock’ functionality by pasting this in their add-on.

Here’s an elegant solution from RiĆ«l Notermans (Zzapps) for letting users unlock premium functionality in your Workspace Add-on without relying on an external fetch or database by using an encrypted JWT web token.

You can include various data in the token and this example a subscription email and expiry is included which can be checked locally, for example, comparing the email from Session.getActiveUser().getEmail().

Source: Use JWT as a license key in Google Apps Script add-ons