none
Test License Key in Visual Studio RRS feed

  • Question

  • I originally posted this question  here and I would add to that one, except every time I try to reply to a comment or reply to the post itself I get an "Unexpected Error" and it fails to post.  So I am attempting this with a new question.  I know it has been a while since I posted the original, but we decided to release a free version first.  Now I really need to get the licensing settled so that we can get paid.

    According to response to the link above, we have to create the test license querystrings ourselves.  This seems very risky to me.  It seems to me that what we need are sample querystrings to test that are provided by Microsoft.  A set that contains:

    • Subscription, trial, one time payment and free types
    • Paid and unpaid (expired) accounts

    If we create the examples ourselves, how can we know if they will be the same as what we will eventually get from the store?  

    This seems vital to me in order to be sure that everything works when we turn it on in the store.  

    Would it be possible to get this?

    Thanks!!!!

    Monday, July 7, 2014 6:57 PM

Answers

  • Hi,

    >> If we create the examples ourselves, how can we know if they will be the same as what we will eventually get from the store? 

    The sample license *.tok file is only for testing purpose. Based on my understanding, after you submit your app to Office App Store. You should use the VerificationServiceClient.VerifyEntitlementToken method to verify the token. Please correct me if I have any misunderstanding about your question.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Collections.Specialized;
    using System.Text;
    using EtokenWeb.OmexTokenService;
    
    namespace EtokenWeb{
    
        public partial class EToken : System.Web.UI.Page{
            public string etoken = "";
            private static VerificationServiceClient service = new VerificationServiceClient();
    
            protected void Page_Load(object sender, EventArgs e){
               
                etoken = Request.QueryString["et"];
                if (etoken != null)
                {
                    Response.Write("my value:" + etoken + "<br>");
                    CallVerificationService(etoken);
                }
                else
                    Response.Write("no token provided<br>?");
            }
    
            private void CallVerificationService(string etoken){
                VerifyEntitlementTokenRequest request = new VerifyEntitlementTokenRequest();
                request.EntitlementToken =  DecodeToken(etoken);
                VerifyEntitlementTokenResponse  omexResponse = service.VerifyEntitlementToken(request);
                Response.Write("Is Test:" + omexResponse.IsTest + "<br>") ;
                Response.Write("User ID: "+ omexResponse.UserId + "<br>") ;
            }
    
            private static string DecodeToken(string encodedToken){
                byte[] decodedBytes = Convert.FromBase64String(encodedToken);
                return Encoding.Unicode.GetString(decodedBytes);
            }
        }
    }

    Hope it will help.

    Regards,

    Jeffrey


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, July 10, 2014 2:35 AM
    Moderator

All replies

  • I do realize that the product ID is encoded in the license...Perhaps a tool that would let you create the things after you input the Product ID?
    Monday, July 7, 2014 7:50 PM
  • Hi,

    >> If we create the examples ourselves, how can we know if they will be the same as what we will eventually get from the store? 

    The sample license *.tok file is only for testing purpose. Based on my understanding, after you submit your app to Office App Store. You should use the VerificationServiceClient.VerifyEntitlementToken method to verify the token. Please correct me if I have any misunderstanding about your question.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Collections.Specialized;
    using System.Text;
    using EtokenWeb.OmexTokenService;
    
    namespace EtokenWeb{
    
        public partial class EToken : System.Web.UI.Page{
            public string etoken = "";
            private static VerificationServiceClient service = new VerificationServiceClient();
    
            protected void Page_Load(object sender, EventArgs e){
               
                etoken = Request.QueryString["et"];
                if (etoken != null)
                {
                    Response.Write("my value:" + etoken + "<br>");
                    CallVerificationService(etoken);
                }
                else
                    Response.Write("no token provided<br>?");
            }
    
            private void CallVerificationService(string etoken){
                VerifyEntitlementTokenRequest request = new VerifyEntitlementTokenRequest();
                request.EntitlementToken =  DecodeToken(etoken);
                VerifyEntitlementTokenResponse  omexResponse = service.VerifyEntitlementToken(request);
                Response.Write("Is Test:" + omexResponse.IsTest + "<br>") ;
                Response.Write("User ID: "+ omexResponse.UserId + "<br>") ;
            }
    
            private static string DecodeToken(string encodedToken){
                byte[] decodedBytes = Convert.FromBase64String(encodedToken);
                return Encoding.Unicode.GetString(decodedBytes);
            }
        }
    }

    Hope it will help.

    Regards,

    Jeffrey


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, July 10, 2014 2:35 AM
    Moderator
  • I am still getting this error while trying to test my license file. No value is given for the et parameter in the url.

    And also the suggested workaround to simply add the token manually into the source location is not working for me because i have the placeholder "~remoteAppUrl" within my manifest. Through Visual Studio this placeholder gets replaced by the url to the local installed IIS Express (also provided by VS). So when I manually add the license token to my SourceLocation in the manifest it gets thrown away through the replacement of Visual Studio. 
    So I must hardcode the url into the manifest what is really inflexible when it comes to publishing to other servers.

    So are there any new insights about the error?

    Best regards
    Christain

    Wednesday, November 29, 2017 10:06 AM