Share via

Microsoft Graph API userInfo endpoint UnknownEror: Token must contain sub claim

Test 21 Reputation points
2021-02-22T05:32:07.4+00:00

I'm trying to execute the userinfo endpoint at https://graph.microsoft.com/oidc/userinfo using an access token received through Open ID Connect.

The response received is:

400 Bad Request

{
"error": {
"code": "UnknownError",
"message": "Token must contain sub claim.",
"innerError": {
"date": "2021-02-22T03:57:51",
"request-id": "533a4343-85ab-45cb-9422-d7ec75677376",
"client-request-id": "533a4343-85ab-45cb-9422-d7ec75677376"
}
}
}

The access token does appear to contain the sub claim, it was visible in https://jwt.io.

If I login to https://developer.microsoft.com/en-us/graph/graph-explorer and try there it works and I notice the sub claim for the access token is different - for the same user.

Can you please help discern what could be the issue?

Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. Алексей Гулаков 1 Reputation point
    2021-09-02T18:16:09.07+00:00

    Have you fixed the error? I have the same one.

    Was this answer helpful?

    0 comments No comments

Your answer

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