9

I have created 4 web parts using SPFX. Now I want implement licensing.

If the user has purchase license then can access web part else user is redirected to license.

  • What is the best approach to fulfilling this requirement?
  • Should I create license component in each web part?

Thanks

4

I won't recommend you to keep your license on the client side. Since the SPFx is completely client side module, anyone can easily go through the code and find all the details, how you are using licensing in you web part.

To your problem, I can recommend using Azure Functions. They are very powerful when it's come to serverless computing (as quoted my Microsoft).

Follow the URL to know more about them. https://docs.microsoft.com/en-us/azure/azure-functions/

  • no we don't wanna go for azure.. – Vaibhav Bhatia Jul 13 '17 at 8:34
  • 1
    then you can go with WCF approach, write your own web service, host them in your environment and use it in SPFx web part. Its not good to write license module in client side. – ThinkB4Code Jul 13 '17 at 8:54
  • yeh i know that..My question is how can i implement it on client side.I mean can i create license component in each webpart or any other way i can use it? – Vaibhav Bhatia Jul 13 '17 at 8:58
  • 2
    In case you have four different SPFx solutions, than Create one more Node.js solution for licensing only. Put all the code related to licensing in it. Export this module and include it in your other SPFx solutions. In case you have all the 4 web part within same solution, than simply add licensing module within the SPFx solution only and use it in all of the web parts. – ThinkB4Code Jul 13 '17 at 14:30
  • I would highly suggest that you make sure that the licensing check makes an off-box call that you make it async and after the webpart has completed rendering. If it fails, then update the div with your error / link / etc. Don't block the normal experience flow though. – PatMill_MSFT Jul 13 '17 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.