Skip to content

Commit 81b3d91

Browse files
committed
add new article
1 parent 4ae6508 commit 81b3d91

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: The Identity of the Calling Application Could Not Be Established
3+
description: Provides solutions to the identity of the calling application could not be established error when using Microsoft Graph.
4+
ms.date: 04/03/2025
5+
ms.service: entra-id
6+
ms.custom: sap:Getting access denied errors (Authorization)
7+
ms.reviewer: willfid, v-weizhu
8+
---
9+
# resolve issues with calling the “me” endpoint in Microsoft Graph
10+
11+
Microsoft Graph provides various methods to retrieve user information from Azure Active Directory (Azure AD). This includes user attributes, group memberships, email access, and more. However, specific endpoints in Microsoft Graph require particular permissions and contexts to function correctly. This article explains the functionality of the “me” endpoint, restrictions associated with it, common errors when using it improperly, and how to resolve these issues.
12+
13+
## Symptoms
14+
15+
When you try to call the `/me` endpoint from your Microsoft Entra ID-based application that use [client credentials grant flow](/entra/identity-platform/v2-oauth2-client-creds-grant-flow), the following error may occur:
16+
17+
json
18+
{
19+
"error": {
20+
"code": "NoPermissionsInAccessToken",
21+
"message": "The token contains no permissions, or permissions can not be understood.",
22+
"innerError": {
23+
"oAuthEventOperationId": "48f66de9-xxx-xxxx1-xxxx-399ea6608ec0",
24+
"oAuthEventcV": "MkVd0xxxxxvjGFVJkoA.1",
25+
"errorUrl": "https://aka.ms/autherrors#error-InvalidGrant",
26+
"requestId": "80f8a0e9-xxxx-xxxx-xxxx-88e5d4bb5bb2",
27+
"date": "2021-07-30T04:04:38"
28+
}
29+
}
30+
}
31+
32+
## Cause
33+
34+
The `/me` endpoint is designed to allow signed-in users to retrieve their own information. To call the `/me` endpoint, it requires a user context because it uses delegated permissions. This means that a token generated by using the client credentials grant flow cannot use the `/me` endpoint due to the absence of user context information.
35+
36+
Tokens obtained using the client credentials grant flow represent application identities, not user identities. These tokens contain a **roles** claim for application permissions instead of a scp (scopes) claim for delegated permissions. The absence of user context makes it impossible for the `/me` endpoint to determine the user associated with the request.
37+
38+
#### Example tokens
39+
40+
**Token with user context (delegated flow with a user signed in)**
41+
42+
This token is granted by using delegated flow with a user signed in. It contains user-specific information and a `scp` claim that contains current user's the permissions:
43+
44+
:::image type="content" source="media/error-call-me-endpoint-microsoft-graph/token-sign-in-user-context.png" alt-text="Delegated token example" lightbox="media/error-call-me-endpoint-microsoft-graph/token-sign-in-user-context.png":::
45+
46+
**Token with application identity (client_credentials grant flow)**
47+
48+
This token is generated by using the client credentials grant flow. It doesn't contain user-specific information, but contains a `roles` claim for application permissions:
49+
50+
:::image type="content" source="media/error-call-me-endpoint-microsoft-graph/token-application-context.png" alt-text="Application token example" lightbox="media/error-call-me-endpoint-microsoft-graph/token-application-context.png":::
51+
52+
## Solution
53+
54+
When you use the client credentials grant flow in your application, you must use the `/users` endpoint instead of the `/me` endpoint. This allows you to retrieve user-specific information using application tokens.
55+
56+
For example, if you want to call `GET https://graph.microsoft.com/v1.0/me/memberOf` to get a list of groups a user is a member of, use the following method:
57+
58+
1. Obtain an application token using the client credentials grant flow.
59+
2. Ensure that the application has the **User.Read.All** permission to query user information.
60+
3. Use the **users** endpoint to query specific user details. Replace {upn} with the User Principal Name (UPN) or User Object ID of the user.
61+
```
62+
GET https://graph.microsoft.com/v1.0/users/{upn or userID}/memberOf
63+
```
64+
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]
83.3 KB
Loading
134 KB
Loading

0 commit comments

Comments
 (0)