How to distinguish between successful and unsuccessful signins returned by the Microsoft Graph API?

Juan Álvarez Martínez 21 Reputation points
2022-10-18T14:16:47.923+00:00

When accessing https://graph.microsoft.com/v1.0/auditLogs/signIns I'm able to retrieve all the latest logs corresponding to the most recent authentication attempts, however, I'm not sure how to distinguish between successful and unsuccessful ones.

Specifically, the API returns the following field for successful attempts:

"status": {
"errorCode": 0,
"failureReason": "Other.",
"additionalDetails": null
}

Is it fair to assume that if the error code for a signing log is zero then it means the authentication attempt was successful? If this is not the case, should I look into "failureReason" or another field to make the distinction?

Thanks!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,096 questions
0 comments No comments
{count} votes

Accepted answer
  1. Shivam Dhiman 5,946 Reputation points
    2022-10-18T22:31:40.617+00:00

    Hi @Juan Álvarez Martínez

    To distinguish between successful and unsuccessful signins please refer to this documentation.

    "signInStatus” resource type provides the sign-in status (Success or Failure) of the sign-in.
    Failure:

    • errorCode - Provides the 5-6 digit error code that's generated during a sign-in failure.
    • failureReason - Provides the error message or the reason for failure for the corresponding sign-in activity.

    Success:

    • errorCode 0 represents successful sign-in.
    • failureReason – other represents successful sign-in

    Please refer to this documentation for more details.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments

0 additional answers

Sort by: Most helpful