在OneDrive中创建Webhook

时间:2017-05-10 06:31:54

标签: node.js curl webhooks onedrive

我正在使用nodejs应用程序在一个驱动器上创建webhook。我使用curl命令创建订阅,一旦它开始工作,我将在我的节点应用程序中实现相同。在curl中执行此操作时,我收到身份验证错误,如下所示:

curl -i -H "Content-Type: application/json" 'Authorization: Bearer EwD4Aq1DBAAUGCCXc8wU/zFu9QnLdZXy+YnElFkAATGSEwq0JnO1Ma9IcsXHwTjlSgfNQ99EsCNLGujskLEypcnXSu5pPQL6+t9E8q0CUOzcyItXnq7avXHTg8DYOWZEn3yqV9cGoXIWB6aHaSmppktO9cCRmaCRUBxMBM3bRGHrh6Imtzktxm8W5e8VUGhf5BBOPoABqzAdyOAMeru7IilO1sscccIRLUaDMJo3FXIB4/IDHWTZIZR+mtjBn/U3/zJKmQ5eEbRCcJ+MFKFUVkzKxJ6cNyxBdnnGiRiHD6y0wLVwTrtNQkSLwa5zZoH0NntK3/CezTBF4n93enopkvnlnQNvBktWnC9LAg0YOBUUKxJ7B84JFdrV+GwK+G0DZgAACBgMKGdSuddlyAFUHheeD+xGuxej1aPu5IVxVHmPzGlU8tbJOmGobztQpkMPP2kSFKYGyCPhWaJHtHEaenXCigLkZnaIENLINi4sKzzw3FD0xUcCv6pPcHSQug4SMKLovihfFH4VFMVR1BRGAWibp2dQl8XxoKvlVdNum1wSOz/byDpq6tG35hF05De6kwYwre4Bjnjt0weoRTfm5xS27PYcPHQ+gLx0LXkclSuDu3IaWXvgArt2tAhAO54upGOhieNdC2nxlbuQBcC1HLLe9IU88lLUlqtrdB6N/DqpYl6n0jgy3Hf6rBZEHGly6ZUpF4uQCiUGV7s5WeYL3jGlXT4i5KthmAYvESpg2WhGdPSoHNMj1YBMQy/P7H9OzdK+MbTmOnGV7Z5eHIwsYkrSfRF6cTC/abEv7I2LSe1uPMFA+yFEQKtgMqwNikQpppn0/jiuXGImAtj1gx0NkFoAPca6H845/AINzbTtk/ykYzmBMjRdJlp7dD9Po4DGLqf0lAJqWqLzHr0GdDAjRLCXYsiaCwmvThX61yd1b7+d3rlYHQxu64kQL9xGX84bVMYDouB2j6ZnvIVbmnuZwg7drpW/EryTxgkGuq+nUDejmVNyic79AQ==' 'https://api.onedrive.com/v1.0/drive/root/subscriptions' --data-binary '{"notificationUrl": "http://192.168.1.63:3001/apicalls", "expirationDateTime": "2017-01-01T11:23:00.000Z", "resource": "/me/drive/root", "changeType": "updated", "clientState": "client-specific string"}'

curl: (6) Couldn't resolve host 'Authorization'
HTTP/1.1 401 Unauthorized
Content-Length: 93
Content-Type: application/json
Server: Microsoft-IIS/8.5
P3P: CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
WWW-Authenticate: Bearer realm="OneDriveAPI"
X-MSNSERVER: CH1AAP3DD1E3A8D
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-QosStats:    {"ApiId":0,"ResultType":2,"SourcePropertyId":0,"TargetPropertyId":42}
X-ThrowSite: 3834.47c0
X-AsmVersion: UNKNOWN; 22.1.0.0
X-MSEdge-Ref: Ref A: 9C995906AB0746C78C753BA1AE94AEB8 Ref B: DEL01EDGE0110   Ref   C: Mon May  8 22:55:26 2017 PST
Date: Tue, 09 May 2017 05:55:25 GMT

{"error":{"code":"unauthenticated","message":"Must be authenticated to use '/drive' syntax"}}

我提供的访问令牌仍然收到验证错误。

1 个答案:

答案 0 :(得分:0)

看起来你没有正确地提供Authorization标题,它实际上是试图将其视为一个端点 - 因此curl: (6) Couldn't resolve host 'Authorization'