首页 > 解决方案 > 当 includeResourceData=true 时,MS 图形创建订阅的 webhook 失败

问题描述

 {
       "changeType": "created,updated,deleted",
       "notificationUrl": "https://somewebsite.com/mswebhook/graph/notifications",
       "resource": "/teams/{team-id}/channels/{channel-id}/messages",
       "expirationDateTime": "2019-12-30T09:41:21Z",
       "clientState": "",
       "includeResourceData": true,
       "encryptionCertificate": "TUlJQklUQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FRNEFNSUlCQ1FLQ0FRQlhFL0xOZjVYYVY4ZFlXbWFuSU9qUwphSnhyUG1tN0dHN0lWOGYwV2RjZDltbUkvaTVXQzhCNFBYaVBKREtKTnVFL2QvMXo5TndSbjR1UFBQQm9sN1BWCmdudVJ6UmZJSVEvUW1TZjYwUi9LUnYybHVlZzVwNW84Qk5UNDczdTRCbVZJVHNBWlF1eG43RGdnUi9JZlQzSVgKelpMdzNXWitDYzJyS1crblpmbUwwU0NiN21EL3RTZ3VqQUJPVEVvS0xBODkvNWhUamhuNzcvWHJzUTYrV1hMVgpKL3NtVDJvU3R3TzBnYXRIRUkwWkRSL0VYNkdVWDRRRVI4M0puS2hPSDJrZzZQNlZUMDFGUEw0Nk5WemZydWE4ClVob052Z0VlQStPY2xBOU5mUUpJQnVKUVFTbGZ0TmhYODJtVEdhVEtBTFN1bWZieUNac1ljQ3l4MXQ5RXF6Qi8KQWdNQkFBRT0=",
       "encryptionCertificateId": "id",
       "lifecycleNotificationUrl": "https://somewebsite.com/mswebhook/graph/notifications"
    }

当这个请求是从邮递员发出的

{
  "error": {
    "code": "InvalidRequest",
    "message": "System.Security.Cryptography.CryptographicException: Cannot find the requested object.\r\n\r\n   at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)\r\n   at System.Security.Cryptography.X509Certificates.X509Utils._QueryCertBlobType(Byte[] rawData)\r\n   at System.Security.Cryptography.X509Certificates.X509Certificate.LoadCertificateFromBlob(Byte[] rawData, Object password, X509KeyStorageFlags keyStorageFlags)\r\n   at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(Byte[] rawData)\r\n   at Microsoft.Graph.Encryptor.Encryptor.ValidateCertificate(String certificate, String& errorMessage) in X:\\bt\\1070414\\repo\\src\\Dev\\Notifications\\Notifications.Azure\\Encryptor\\Encryptor.cs:line 293",
    "innerError": {
      "request-id": "e578bdba-2c47-41d7-a0da-5395b05e4203",
      "date": "2019-12-31T06:57:59"
    }
  }
}

没有 includeResourceData 属性,订阅和通知工作正常。我在选择encryptionCertificate 属性时遇到问题。目前我在encryptionCertificate 中传递Base64bit 编码的2048 位RSA 公钥(在线生成)。

标签: postmanmicrosoft-graph-apiwebhooks

解决方案


推荐阅读