MS Graph Subscriptions Webhooks to Node JS Google Cloud Functions - Stack Overflow

I am trying to connect MS Graph Subscriptions to a Google HTTP Cloud Function on Node.js.To establish

I am trying to connect MS Graph Subscriptions to a Google HTTP Cloud Function on Node.js. To establish the trust between the MS Graph subscription and the HTTP Cloud Function a token needs to be exchanged. The token is received by the HTTP function and returned back to MS Graph but a Valdidation Error occurs.

{
    "error": {
        "code": "ValidationError",
        "message": "d2e35dec-a4ba-9142-1129-139539c37a74",
        "innerError": {
            "date": "2025-02-02T17:07:07",
            "request-id": "a975ae23-b3ae-454f-892a-581465fe87ba",
            "client-request-id": "d2e35dec-a4ba-9142-1129-139539c37a74"
        }
    }
}

The response from the HTTP Cloud Function as per below.

functions.http('groupsHttp', (req, res) => {

    let validationToken = req.query.validationToken;
    let validationTokenArray = validationToken.split(' ');
    let finalToken = validationTokenArray.at(-1).toString();

    return res.setHeader('Content-Type', 'text/plain; charset=utf-8').status(200).send(finalToken);

});

According to Microsoft these requirements need to be in place. 1.An HTTP 200 Status Code must be returned 2.The Content-Type must be of ‘text/plain’ 3.Return a body containing the Validation Token that was provided by the initial Graph request 4.All this must be done within 10 seconds of the initial Graph request

Any hint or idea what is missing here?

Tried various options of returning the response correctly but it is declined by MS Graph every time even when message and client-id aka token are matching.

I am trying to connect MS Graph Subscriptions to a Google HTTP Cloud Function on Node.js. To establish the trust between the MS Graph subscription and the HTTP Cloud Function a token needs to be exchanged. The token is received by the HTTP function and returned back to MS Graph but a Valdidation Error occurs.

{
    "error": {
        "code": "ValidationError",
        "message": "d2e35dec-a4ba-9142-1129-139539c37a74",
        "innerError": {
            "date": "2025-02-02T17:07:07",
            "request-id": "a975ae23-b3ae-454f-892a-581465fe87ba",
            "client-request-id": "d2e35dec-a4ba-9142-1129-139539c37a74"
        }
    }
}

The response from the HTTP Cloud Function as per below.

functions.http('groupsHttp', (req, res) => {

    let validationToken = req.query.validationToken;
    let validationTokenArray = validationToken.split(' ');
    let finalToken = validationTokenArray.at(-1).toString();

    return res.setHeader('Content-Type', 'text/plain; charset=utf-8').status(200).send(finalToken);

});

According to Microsoft these requirements need to be in place. 1.An HTTP 200 Status Code must be returned 2.The Content-Type must be of ‘text/plain’ 3.Return a body containing the Validation Token that was provided by the initial Graph request 4.All this must be done within 10 seconds of the initial Graph request

Any hint or idea what is missing here?

Tried various options of returning the response correctly but it is declined by MS Graph every time even when message and client-id aka token are matching.

Share Improve this question asked Feb 2 at 20:40 Ben SchleefBen Schleef 1
Add a comment  | 

1 Answer 1

Reset to default 0

Got the issue. You need to return not only the token but the whole string in text/plain to make it work.

functions.http('groupsHttp', (req, res) => {

    let validationToken = req.query.validationToken;

    return res.set('Content-Type', 'text/plain; charset=utf-8').status(200).send(validationToken);

});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745257461a4619042.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信