我想订阅用户删除,以便每当在 Azure AD 中删除用户时,我们的应用程序都可以做出相应的 react 。
这是我的订阅请求:
const now = new Date();
const threeDaysLater = new Date(now.getTime() + 3 * 24 * 58 * 60 * 1000);
request.post({
auth: {
bearer: {...},
},
headers: {
Accept: 'application/json',
},
json: {
changeType: 'updated,deleted',
clientState: {...},
expirationDateTime: threeDaysLater.toISOString(),
notificationUrl: 'https://{...}.ngrok.io/api/azure/webhook',
resource: 'users',
latestSupportedTlsVersion: 'v1_2',
},
url: 'https://graph.microsoft.com/v1.0/subscriptions',
});
发送此请求后,我会收到一个发送到我的 notificationUrl
的请求,我会使用验证 token 进行响应。
然后我收到来自初始请求的以下响应:
{
'@odata.context':
'https://graph.microsoft.com/v1.0/$metadata#subscriptions/$entity',
id: {...},
resource: 'users',
applicationId: {...},
changeType: 'updated,deleted',
clientState: {...},
notificationUrl: 'https://{...}.ngrok.io/api/azure/webhook',
expirationDateTime: '2020-03-22T11:52:36.328Z',
creatorId: {...},
latestSupportedTlsVersion: 'v1_2'
}
但是,当我实际进入 Azure AD 并删除用户时,我从未收到对我的端点的任何请求...知道我在这里做错了什么吗?
我见过Not receiving a request on our MS Graph Webhook for deleting a User in AAD ,但我都等了30分钟,并尝试了软+硬删除。两者似乎都没有触发对我的端点的任何类型的请求。
最佳答案
好吧,显然我只是不够耐心。 MS 可能需要数小时来发送这些通知请求。
如果您正在开发 Webhook 端点,并希望对其进行测试/调试,请在 Azure AD 中执行该操作,然后在几个小时内执行其他操作,直到最终收到请求。 🙄
关于azure - 未收到 Microsoft Graph 更改通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60760219/