azureoffice-jsoutlook-web-addinsyooffice-store

License Implementation on outlook add-in with react and yeoman office-generator


I have created outlook add-in using react and npm which I have deployed to azure web application.

Now, I need to implement the licensing in this outlook add-in.

I'm referring this MSDN article which provides steps to add license check to the outlook/SharePoint addin.

As per the article we need to pass a Query String parameter "et" which is a base-64 and URL-encoded version of the license token.

  • Where can I get that License Token?
  • Where should I place .tok file as for dev purpose I'm only deploying extension-xml file to manage-add-in section. How can I test licencing before uploading to app-store?

Solution

  • Please note from the linked article, there are special cases for license implementation and testing for Outlook add-ins.

    Where can I get the License Token?

    Quoting from the article:

    To create a test token:

    • Copy the example license schema into a text file and save it with a .tok extension.
    • Change the appropriate attributes, such as Product ID.
    • Make sure the test attribute is present and set equal to true.

    Per the last quote below, so long as the token has a valid schema, the values are not validated when the test attribute is included and is set to true.

    Where should I place the token?

    Then for testing in Outlook, rather than using the .tok file, the token should be URL-encoded and appended as a parameter to the SourceLocation in the add-in's XML manifest.

    For Outlook add-ins:

    • Create your test token.
    • Create a URL-encoded version of the add-in license token.
    • In the add-in manifest file, manually edit the appropriate SourceLocation element. Add the URL-encoded version of the license token to the source location URL as a query parameter named et .

    Note "For Outlook add-ins, the et query parameter string is only URL-encoded, and not base-64 encoded." See the original article following this quote for an example of a SourceLocation URL with an encoded token.

    How to test licensing before submitting the add-in?

    From the License Schema article:

    To support add-in license testing, the AppSource verification web service does not validate the encryption token or any of the attribute values of license tokens where the test attribute is set to true. However, the service does interpret the token, and all the properties of the VerifyEntitlementTokenResponse object returned by the service can be read.

    This means even though the values are not validated, the object returned by the verification service will contain the values in the test token. So, you can change those values to test different scenarios in your add-in (see the original article and related articles for ideas on what scenarios to test).