Nodejs - Office App License token verification ser

2019-09-07 11:00发布

I am developing office Apps using NodeJS. As part of that , I have to implement license check that would validate the token sent along with app url from office store.

I referred the link http://msdn.microsoft.com/en-us/library/office/jj163908(v=office.15).aspx#bk_implement

Here follows my code :

  var licence_code = req.param('et'); // this is equivalent to decodeURIComponent('token present in the url');

  // Applies base64 decoding of the token to get a decoded token
  var decode_base64 = new Buffer(license_code,'base64'); 
  var code = decode_base64.toString();

  // Using nodejs request module to make rest call to office verification service

  request(
    { method: 'GET'
    ,     uri:'https://verificationservice.officeapps.live.com/ova/verificationagent.svc/rest/verify?token=' + code
    }
  , function (error, response, body) {
       console.log(body);
    }
  );

I am always used to get the same invalid response from Office Verification Service as below:

<VerifyEntitlementTokenResponse xmlns="http://schemas.datacontract.org/2004/07/Microsoft.OfficeMarketplace.ServicePlatform.VerificationAgent.Service.Contract" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<AssetId i:nil="true"/>
<DeploymentId i:nil="true"/>
<EntitlementAcquisitionDate>0001-01-01T00:00:00</EntitlementAcquisitionDate>
<EntitlementExpiryDate i:nil="true"/>
<EntitlementType i:nil="true"/>
<IsEntitlementExpired>false</IsEntitlementExpired>
<IsExpired>false</IsExpired>
<IsSiteLicense>false</IsSiteLicense>
<IsTest>false</IsTest>
<IsValid>false</IsValid>
<ProductId i:nil="true"/>
<Seats>0</Seats>
<SignInDate>0001-01-01T00:00:00</SignInDate>
<SubscriptionState i:nil="true"/>
<TokenExpiryDate>0001-01-01T00:00:00</TokenExpiryDate>
<UserId i:nil="true"/>
</VerifyEntitlementTokenResponse>

Pls check whether i use the token decoding correctly or issue in that. Help me to resolve this issue.

Thanks Ram

0条回答
登录 后发表回答