Skip to content

Commit 800e35c

Browse files
authored
Merge pull request #8755 from MicrosoftDocs/main
Auto push to live 2025-04-18 10:01:50
2 parents 957fe15 + 335a848 commit 800e35c

File tree

4 files changed

+77
-8
lines changed

4 files changed

+77
-8
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: NoPermissionsInAccessToken when calling me endpoint in Microsoft Graph
3+
description: Describes an issue in which you receive `NoPermissionsInAccessToken` error when you call `/me` endpoint in Microsoft Graph.
4+
ms.date: 04/03/2025
5+
ms.service: entra-id
6+
ms.author: bhvootla
7+
ms.custom: sap:Getting access denied errors (Authorization)
8+
ms.reviewer: nualex,vganga,adoyle,custorod
9+
---
10+
# NoPermissionsInAccessToken when calling /me endpoint
11+
12+
This article discusses an issue in which you receive a `NoPermissionsInAccessToken` error message when you call the `/me` endpoint in Microsoft Graph. This article also explains why you can't call the `/me` endpoint by using a token that is acquired through the client credentials grant flow.
13+
14+
## Symptoms
15+
16+
When you try to call the `/me` endpoint from your Microsoft Entra ID-based application that uses [client credentials grant flow](/entra/identity-platform/v2-oauth2-client-creds-grant-flow), you receive the following error message:
17+
18+
```output
19+
{
20+
"error": {
21+
"code": "NoPermissionsInAccessToken",
22+
"message": "The token contains no permissions, or permissions can not be understood.",
23+
"innerError": {
24+
"oAuthEventOperationId": "48f66de9-xxx-xxxx1-xxxx-399ea6608ec0",
25+
"oAuthEventcV": "MkVd0xxxxxvjGFVJkoA.1",
26+
"errorUrl": "https://aka.ms/autherrors#error-InvalidGrant",
27+
"requestId": "80f8a0e9-xxxx-xxxx-xxxx-88e5d4bb5bb2",
28+
"date": "2021-07-30T04:04:38"
29+
}
30+
}
31+
}
32+
```
33+
34+
## Cause
35+
36+
The `/me` endpoint is designed to enable signed-in users to retrieve their own information. To call the `/me` endpoint, you must provide some user context because the endpoint uses delegated permissions. That is, a token that's generated by using the client credentials grant flow can't use the `/me` endpoint because the user context information is absent.
37+
38+
Tokens that are obtained by 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 who is associated with the request.
39+
40+
### Example tokens
41+
42+
**Token with user context (delegated flow with a user signed in)**
43+
44+
This token is granted by using delegated flow to which a user signed in. It contains user-specific information and a `scp` claim that contains the current user's permissions.
45+
46+
:::image type="content" source="media/error-call-me-endpoint-microsoft-graph/token-sign-in-user-context.png" alt-text="Screenshot that shows a delegated token example." lightbox="media/error-call-me-endpoint-microsoft-graph/token-sign-in-user-context.png":::
47+
48+
**Token with application identity (client_credentials grant flow)**
49+
50+
This token is generated by using the client credentials grant flow. It doesn't contain user-specific information. Instead, it contains a `roles` claim for application permissions.
51+
52+
:::image type="content" source="media/error-call-me-endpoint-microsoft-graph/token-application-context.png" alt-text="Screenshot that shows an application token example." lightbox="media/error-call-me-endpoint-microsoft-graph/token-application-context.png":::
53+
54+
## Solution
55+
56+
When you use the client credentials grant flow in your application, you must use the `/users` endpoint instead of the `/me` endpoint. The `/users` endpoint enables you to retrieve user-specific information by using application tokens.
57+
58+
For example, if you want to call `GET https://graph.microsoft.com/v1.0/me/memberOf` to generate a list of groups that a user is a member of, use the following method:
59+
60+
1. Obtain an application token by using the client credentials grant flow.
61+
2. Make sure that the application has the **User.Read.All** permission to query user information.
62+
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.
63+
```HTTP
64+
GET https://graph.microsoft.com/v1.0/users/{upn or userID}/memberOf
65+
```
66+
67+
[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)]
83.3 KB
Loading
134 KB
Loading

support/power-platform/power-apps/connections/best-practices-when-updating-a-flow.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Error codes on Flow run
33
description: Describes best practices and steps to mitigate common errors when running Microsoft flows in Power Apps.
44
ms.reviewer: mlalavat
5-
ms.date: 03/01/2024
5+
ms.date: 04/18/2025
66
ms.custom: sap:Connections\Creating or updating connections
77
---
88
# Best practices when updating a flow used by a Power App
@@ -173,7 +173,7 @@ The reason is that there might be a change to the flow in the target environment
173173
> [!NOTE]
174174
> There can be no unmanaged layers on either the flow or the app because this can cause issues in connection to the flow.
175175
176-
## Error code "NotAllowedConnectionReferenceon" on Flow run
176+
## Error code "NotAllowedConnectionReference" on Flow run
177177

178178
```output
179179
{
@@ -197,6 +197,8 @@ This error means that the app has flow metadata that specifies that a SQL connec
197197
198198
#### Mitigation option 1
199199

200+
Reset the flows in the app:
201+
200202
1. In the source environment, edit the app. Remove and then re-add the flows to the app. Save and publish the changes.
201203
2. In the target environment, remove all unmanaged layers on the app and flow.
202204
3. Export the solution and import it into the target environment.
@@ -206,12 +208,12 @@ This error means that the app has flow metadata that specifies that a SQL connec
206208
207209
#### Mitigation option 2
208210

209-
1. Change the connection from **Embedded** to **Invoker**.
210-
2. Navigate to the flow portal to edit and update the flow settings.
211-
3. On the flow details page, in the **Run only users** section, select **Edit**.
212-
4. To update the flow connection source to **Invoker**, select **Provided by run-only user** and save.
213-
5. To update the flow connection source to **Embedded**, select **Use this connection** and save.
214-
6. Verify by triggering the flow. You see that the "install flow network" calls now are succeeding.
211+
Change the connection from **Embedded** to **Invoker**:
212+
213+
1. Navigate to the flow portal to edit and update the flow settings.
214+
2. On the flow details page, in the **Run only users** section, select **Edit**.
215+
3. To update the flow connection source to **Invoker**, select **Provided by run-only user** and save.
216+
4. Verify by triggering the flow. You see that the "install flow network" calls are now successful.
215217

216218
## Other symptoms
217219

0 commit comments

Comments
 (0)