How to programmatically check if the license key used is valid

Posted by: ampires9 on 10 December 2018, 11:22 pm EST

  • Posted 10 December 2018, 11:22 pm EST


    How can I check programmatically if the license key used is valid?

    At present I have to rely on the Spread library showing an license key error when attempting to load the UI, however there are times where this doesn't happen because an error is thrown further up the chain (due to an incorrect license key) and the UI is never shown.

    I would therefore like to check if the license key is valid before anything else is run and display a custom error message. How do I do this?

  • Replied 11 December 2018, 8:43 pm EST


    Unfortunately, there is no way to check if the license is valid or not before the page loads because it's a runtime license. Hence, could you please share your use case i.e. why do you want to check if the license key is valid or not before the page gets load.

    Please share your use case. We will look into the same thereon.

  • Replied 16 December 2018, 12:08 am EST

    Hi Reeva,

    The use case is to display a custom error message instead of the default error that is displayed on the UI when a license key is either not found or invalid. The default error has a black background with white text describing the problem, which can be viewed in this video at the 1:28 mark:

    Is there a callback of some sort that is invoked if the license key is invalid?

  • Marked as Answer

    Replied 17 December 2018, 4:40 pm EST


    The license is not part of the product functionality, hence there isn't any way to display custom message when there is "Invalid License Key" error.

    On the development machine there is no need for license as the application will run with a watermark at the bottom right corner of the spread stating it's a trial product.

    However, once you are ready to deploy your application then you can generate a distribution key from our website( if you have purchased a SpreadJs License) and you can use it in your application while deploying.

    Hope it clarifies.

  • Replied 21 October 2020, 10:22 am EST

    I have another use case for this. So our production app does not break if we mess up the key. I just want an error to be thrown or a callback.
  • Replied 21 October 2020, 11:48 pm EST

    Hi Jeff,

    We are sorry but this is part of our current licensing policy. You would have to make sure that you have added the correct license key before deploying the application on the server.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels