SDKs
...
v2
Samples
How to Run the Sample Files
6min
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, you can use the provided exampleonlineactivation() sample function simply 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 func main() { err = exampleonlineactivation(true, "your product code") if err != nil { fmt println(err) } } important notes ensure you have created a license that supports online activation if you are using oauth, make sure the first parameter (useoauth) is set to true all required credentials must be correctly set up in your config yaml file running the online activation with consumption sample the next sample demonstrates how to activate a license , add consumption , sync the consumption , revert the license back to its previous state, and then deactivate it you can use the provided exampleonlineactivationaddconsumption() function to perform this flow to run it, simply 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 func main() { err = exampleonlineactivationaddconsumption(true, "your consumption product code") if err != nil { fmt println(err) } } important notes ensure the license you use is a consumption based online license all required credentials and product information must be correctly configured in your config yaml if you are using oauth, remember to pass true for the first parameter similar to the samples explained here, there are additional sample files available in the repository these cover a wide range of scenarios such as offline activation , air gapped environments , floating licenses , and more each sample is provided with detailed comments to guide you step by step through the process