How to Run the Sample Files
Clear and practical samples are provided to demonstrate how to run specific licensing scenarios. You can use these samples as a foundation to build more advanced or customized workflows.
Currently, the samples require a config.yaml file located in the same directory. You must populate it with your credentials — including either OAuth credentials (client ID and client secret) or API/Shared keys — along with product details such as the product code and corresponding license credentials (either a license key or username/password pair).
Please note that most samples are written assuming key-based licenses by default, but you can easily adapt them for username/password licenses by updating the configuration.
Step 1: Fill out config.yaml
Here’s an example structure:
clientId: "your-client-id"
clientSecret: "your-client-secret"
cryptoProviderKey: "your-crypto-provider-key" # Required if using OAuth
apiKey: "your-api-key"
sharedKey: "your-shared-key"
verbose: true
verify_signature: true
products:
productCode1:
licenseKey: "your-license-key"
productCode2:
username: "your-username"
password: "your-password"If you are using OAuth, make sure to fill in the cryptoProviderKey field.
If you are using API/SharedKey authentication, you can leave the OAuth fields empty.
Running the Online Activation Sample
To run a sample that activates, checks, and deactivates a license, use the provided ExampleOnlineActivation() sample function.
Call this function inside your main function and provide it with two parameters:
useOAuth (bool): Set to true if you are using OAuth authentication, otherwise false.
productCode (string): The product code of the license you want to activate.
Example:
Running the Online Activation with Consumption Sample
This sample demonstrates how to activate a license, add consumption, sync the consumption, revert the license back to its previous state, and then deactivate it.
Use the provided ExampleOnlineActivationAddConsumption() function to perform this flow.
Call the function inside your main function and pass two parameters:
useOAuth (bool): Set to true if you are using OAuth authentication, otherwise false.
productCode (string): The product code for the online consumption license you want to test.
Example:
Was this helpful?