【发布时间】:2017-08-02 22:37:25
【问题描述】:
我正在尝试将应用程序订阅到 Sharepoint 列表。通知将通过 webhook 发送到应用程序。为此,您必须发出 HTTP POST 请求:
https://{your-account}.sharepoint.com/_api/web/lists('{list-guid}')/subscriptions
主体:
{
"resource": "{{ URL of the resource Id }}",
"notificationUrl" : "{{ URL of the endpoint that will process the webhooks }}",
"expirationDateTime" : "2017-09-27T00:00:00+00"
}
调用需要访问令牌。我以这种方式使用 curl 获得了令牌:
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "client_id={{ Id of the application registered on Azure Active Directory }}&client_secret={{ Key added on Azure for the app }}&grant_type=client_credentials&resource=https%3A%2F%2F{{ My account }}.sharepoint.com" "https://login.microsoftonline.com/{{ Azure account tenant id}}/oauth2/token"
这将返回一个令牌,该令牌作为标头包含在 POST 请求中。不幸的是,此请求失败,错误代码为 401。正文:
{
"error_description" : "The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs."
}
我认为问题不在于令牌,我们尝试了太多次才停止抛出与无效令牌数据相关的错误。
有没有办法调试这个错误?有什么建议么?
【问题讨论】:
标签: azure sharepoint azure-active-directory webhooks