Azure B2C:未接收用户 Activity 的 Webhook 通知

Azure B2C: Webhook Notifications of User Activity Aren't Being Picked Up

由于 that I've been dealing with Azure B2C, I was thinking of using notification webhooks 接收有关用户何时 created/updated 的信息。

虽然我能够创建对 users 资源的订阅,但当我实际上 create/update 用户通过图表 API 时,webhook 不会触发。

我创建订阅如下:

POST https://graph.microsoft.com/v1.0/subscriptions
{
   "changeType":"updated",
   "notificationUrl":"https://a7500b01de1c.ngrok.io/b2chook/Users",
   "resource":"users",
   "expirationDateTime":"2021-08-09T01:50:17.699528+00:00"
}

侦听订阅的 webhook 正在 Python 通过 Flask 完成。

这是为接收 webhook 通知而编写的当前代码:

class B2CUserHook(Resource):
    @staticmethod
    def post():
        logger.debug(f"Microsoft Graph API notified the endpoint!")
        if "validationToken" in request.args:
            token = request.args.get('validationToken')
            #res = make_response(token, 201)
            #res.mimetype = "text/plain"
            logger.debug(f"Token to return back to Graph API: {token}")
            return Response(token, mimetype="text/plain")
        
        return Response(status=202)

随着 url 被声明为资源:

api.add_resource(user_controller.B2CUserHook, "/b2chook/Users")

那么,我该如何解决这个问题才能收到通知?

它在链接文档中说: 不支持 Azure AD B2C 租户