Microsoft Graph API - Event listeners unable to PATCH using client credentials, GET/POST/DELETE work fine. Invalid request error.

GustavoC 15 Reputation points
2024-08-16T22:10:35.4533333+00:00

Hello,

I'm unable to use Microsoft Graph API to update an AuthenticationEventListener with client credentials access token.

I'm able to successfully call the POST/GET/DELETE calls with the same access token.

I get the following error

{
    "error": {
        "code": "AADB2C",
        "message": "The request body is null or in bad format",
        "innerError": {
            "correlationId": "9afd1bec-80fe-4dc6-90f9-69611e32694d",
            "date": "2024-08-16T21:50:52",
            "request-id": "4a2b9f30-fdd5-4b39-b491-0b386cb3b0a0",
            "client-request-id": "4a2b9f30-fdd5-4b39-b491-0b386cb3b0a0"
        }
    }
}

I tried to make the PATCH call following the Graph reference as this, https://learn.microsoft.com/en-us/graph/api/authenticationeventlistener-update?view=graph-rest-1.0&tabs=http

Even when I'm using the same body payload (with a valid appId in my own tenant) as the documented example, the error is the same.

The "EventListener.ReadWrite.All" token role is showing up in the token. So I'm able to perform other EventListener operations.

Sample request body

PATCH https://graph.microsoft.com/v1.0/identity/authenticationEventListeners/{
Content-Type: application/json

{
    "@odata.type": "#microsoft.graph.onTokenIssuanceStartListener",
    "conditions": {
        "applications": {
            "includeApplications": [
                {
                    "appId": "6f52f47f-0045-467d-a461-e8415ce6aa4b"
                }
            ]
        }
    }
}

Any help on how to successfully request PATCH to update authentication event listener using client credential token would be very helpful.

Thank you

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,017 questions
{count} vote

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.