如何将npm包oauth-signature导入/插入角度4?

时间:2018-03-20 08:42:50

标签: angular xero-api

这样我就可以在角度cli中使用/执行此功能。

  

/ var httpMethod ='GET',       url ='http://photos.example.net/photos',       parameters = {           oauth_consumer_key:'dpf43f3p2l4k3l03',           oauth_token:'nnch734d00sl2jdk',           oauth_nonce:'kllo9940pd9333jh',           oauth_timestamp:'1191242096',           oauth_signature_method:'HMAC-SHA1',           oauth_version:'1.0',           档案:'vacation.jpg',           尺码:'原创'       },       consumerSecret ='kd94hf93k423kf44',       tokenSecret ='pfkkdhi9sl3r4s00',       //生成RFC 3986编码的BASE64编码HMAC-SHA1哈希       encodedSignature = oauthSignature.generate(httpMethod,url,parameters,consumerSecret,tokenSecret),       //生成BASE64编码HMAC-SHA1哈希       signature = oauthSignature.generate(httpMethod,url,parameters,consumerSecret,tokenSecret,           {encodeSignature:false}); /

1 个答案:

答案 0 :(得分:1)

您是否尝试安装它:

npm install oauth-signature

然后以这种方式导入它?

import * as oauth from 'oauth-signature';