Nodejs - Office App License token verification service does not validate the token

☆樱花仙子☆ 提交于 2019-12-25 12:13:17

问题


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

来源:https://stackoverflow.com/questions/22890933/nodejs-office-app-license-token-verification-service-does-not-validate-the-tok

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!