You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Invalid client error (AADSTS7000218) when authenticating to Microsoft Entra ID
2
+
title: Invalid Client Error AADSTS7000218 When Authenticating to Microsoft Entra ID
3
3
description: Provides a solution to the AADSTS7000218 error when a confidential client application authenticates to Microsoft Entra ID.
4
-
ms.date: 04/23/2025
4
+
ms.date: 04/25/2025
5
5
ms.reviewer: bachoang, v-weizhu
6
6
ms.service: entra-id
7
7
ms.custom: sap:Developing or Registering apps with Microsoft identity platform
@@ -26,70 +26,70 @@ When a confidential client application authenticates to Microsoft Entra ID to ge
26
26
27
27
## Cause
28
28
29
-
This issue occurs because the application doesn't provide its credential (a client secret or a client assertion) as expected by the token endpoint. A confidential client must provide its credential when authenticating to Microsoft Entra ID.
29
+
This issue occurs because the application doesn't provide the credentials (client secret or assertion) that the token endpoint expects. A confidential client must provide its credentials when authenticating to Microsoft Entra ID.
30
30
31
31
## Resolution
32
32
33
-
To resolve this issue, include the client secret or client assertion in the token request.
33
+
To resolve this issue, include the client secret or assertion in the token request.
34
34
35
-
In some authentication flow scenarios such as [OAuth 2 Resource Owner Password Credentials (ROPC)](/entra/identity-platform/v2-oauth-ropc) grant flow or [OAuth 2 device authorization grant flow](/entra/identity-platform/v2-oauth2-device-code) where you don't expect the client application to be confidential, allow public client flows in the **App registrations**:
35
+
In some authentication flow scenarios, such as the [OAuth 2 Resource Owner Password Credentials (ROPC)](/entra/identity-platform/v2-oauth-ropc) grant flow or [OAuth 2 device authorization grant flow](/entra/identity-platform/v2-oauth2-device-code), where you don't expect the client application to be confidential, allow public client flows in the **App registrations**:
36
36
37
37
1. In the [Azure portal](https://portal.azure.com/), in **App registrations**, select your application, and then select **Authentication**.
38
38
2. Select **Advanced settings** > **Allow public client flows**.
39
39
3. For **Enable the following mobile and desktop flows**, select **Yes**.
40
40
41
-
:::image type="content" source="media/confidential-client-application-authentication-error-aadsts7000218/allow-public-client-flows.png" alt-text="Screenshot that shows the 'Enable the following mobile and desktop flows' option" lightbox="media/confidential-client-application-authentication-error-aadsts7000218/allow-public-client-flows.png":::
41
+
:::image type="content" source="media/confidential-client-application-authentication-error-aadsts7000218/allow-public-client-flows.png" alt-text="Screenshot that shows the 'Enable the following mobile and desktop flows' option." lightbox="media/confidential-client-application-authentication-error-aadsts7000218/allow-public-client-flows.png":::
42
42
43
-
Changing the default client type from confidential to public causes security implications. For more information, see [What’s the security implication of changing the default client type from confidential to public in Azure AD?](https://blogs.aaddevsup.xyz/2020/09/whats-the-security-implication-of-changing-the-default-client-type-from-confidential-to-public-in-azure-ad/)
43
+
Changing the default client type from confidential to public causes security implications. For more information, see [What's the security implication of changing the default client type from confidential to public in Azure AD?](https://blogs.aaddevsup.xyz/2020/09/whats-the-security-implication-of-changing-the-default-client-type-from-confidential-to-public-in-azure-ad/)
44
44
45
45
## Understand client types in Microsoft Entra ID
46
46
47
-
As defined in the [OAuth 2.0 specifications](https://tools.ietf.org/html/rfc6749), client applications are categorized into two types:
47
+
As defined in the [OAuth 2.0 specification](https://tools.ietf.org/html/rfc6749), client applications are categorized into two types:
48
48
49
-
- Confidential client: A client who is able to securely store a secret used to authenticate to Microsoft Entra ID.
49
+
- Confidential client: A client that can securely store a secret used to authenticate to Microsoft Entra ID.
50
50
51
-
For example: The client is a web application where its code and secret are stored on a server that’s not exposed to the public. The application's confidential information can only be accessed by an admin.
51
+
For example, the client is a web application whose code and secrets are stored on a server that isn't exposed to the public. Only an admin can access the application's confidential information.
52
52
- Public client: A client that can't store any secret.
53
53
54
-
For example: A public client is a mobile application or desktop application running in an insecure or unmanaged environment.
54
+
For example, a public client is a mobile or desktop application running in an insecure or unmanaged environment.
55
55
56
-
In the Microsoft Entra App Registration model, a registered application can be both a public client and a confidential client, depending on the context the application is used in. This is because an application might have part of it used as a public client while some other parts are designed to be used as a confidential client. Depending on workflows, the application developer must decide if the application should act as a public or confidential client. A confidential client is expected in certain OAuth2 grant flows such as Client Credentials flow, Authorization Code flow, or On-Behalf-Of flow. It uses a flow to request a token.
56
+
In the Microsoft Entra App Registration model, a registered application can be both a public client and a confidential client, depending on the context in which the application is used. This is because an application might have a part used as a public client, while other parts are designed to be used as a confidential client. Depending on workflows, the application developer must decide if the application should act as a public or confidential client. A confidential client is expected in certain OAuth2 grant flows, such as the Client Credentials flow, Authorization Code flow, or On-Behalf-Of flow. It uses a flow to request a token.
57
57
58
58
## How Microsoft Entra ID determines the client type
59
59
60
60
- Method 1: Use the type of the redirect URI (reply URL)
61
61
62
62
Microsoft Entra ID checks the redirect URI (reply URL) provided in the request and cross-checks it with the redirect URI registered in the App Registrations.
63
-
- A **Web** type redirect URI classifies the application as a confidential client.
63
+
- A redirect URI of type **Web** classifies the application as a confidential client.
64
64
65
-
:::image type="content" source="media/confidential-client-application-authentication-error-aadsts7000218/web-client-type.png" alt-text="Screenshot that shows a Webtype redirect URI" lightbox="media/confidential-client-application-authentication-error-aadsts7000218/web-client-type.png":::
66
-
- A **Mobile and desktop applications** type redirect URI classifies the application as a public client.
65
+
:::image type="content" source="media/confidential-client-application-authentication-error-aadsts7000218/web-client-type.png" alt-text="Screenshot that shows a Web-type redirect URI." lightbox="media/confidential-client-application-authentication-error-aadsts7000218/web-client-type.png":::
66
+
- A redirect URI of type **Mobile and desktop applications** classifies the application as a public client.
67
67
68
-
:::image type="content" source="media/confidential-client-application-authentication-error-aadsts7000218/public-client-type.png" alt-text="Screenshot that shows a publictype redirect URI" lightbox="media/confidential-client-application-authentication-error-aadsts7000218/public-client-type.png":::
68
+
:::image type="content" source="media/confidential-client-application-authentication-error-aadsts7000218/public-client-type.png" alt-text="Screenshot that shows a public-type redirect URI." lightbox="media/confidential-client-application-authentication-error-aadsts7000218/public-client-type.png":::
69
69
70
70
- Method 2: Use the **Enable the following mobile and desktop flows** option (when no reply URL is provided)
71
71
72
-
In some OAuth 2.0 flows, such as the [OAuth 2 Resource Owner Password Credentials (ROPC)](/azure/active-directory/develop/v2-oauth-ropc) grant flow, [OAuth 2 device authorization grant flow](/entra/identity-platform/v2-oauth2-device-code) and Integrated Windows Authentication, there is no reply URL provided in the token request. In these cases, Microsoft Entra ID uses the app registration's **Enable the following mobile and desktop flows** to determine whether the client is confidential or public.
72
+
In some OAuth 2.0 flows, such as the [OAuth 2 Resource Owner Password Credentials (ROPC)](/azure/active-directory/develop/v2-oauth-ropc) grant flow, [OAuth 2 device authorization grant flow](/entra/identity-platform/v2-oauth2-device-code) and Integrated Windows Authentication, no reply URL is provided in the token request. In these cases, Microsoft Entra ID uses the app registration's **Enable the following mobile and desktop flows** to determine whether the client is confidential or public.
73
73
74
74
- If **Enable the following mobile and desktop flows** is set to **Yes**, the client is public.
75
75
- If it's set to **No**, the client is confidential.
76
76
77
77
### How to identify the grant type and redirect URI used by an application
78
78
79
-
Review the application code or capture a [Fiddler](https://blogs.aaddevsup.xyz/2018/09/capture-https-traffic-with-http-fiddler/) trace to inspect the grant_type and redirect_uri parameters sent in the POST request to Microsoft Entra ID's token endpoint:
79
+
Review the application code or capture a [Fiddler](https://blogs.aaddevsup.xyz/2018/09/capture-https-traffic-with-http-fiddler/) trace to inspect the `grant_type` and `redirect_uri` parameters sent in the POST request to the Microsoft Entra ID's token endpoint:
:::image type="content" source="media/confidential-client-application-authentication-error-aadsts7000218/post-request.png" alt-text="Screenshot hat shwos a POST request in Fiddler" lightbox="media/confidential-client-application-authentication-error-aadsts7000218/post-request.png":::
86
+
:::image type="content" source="media/confidential-client-application-authentication-error-aadsts7000218/post-request.png" alt-text="Screenshot that shows a POST request in Fiddler.":::
87
87
88
-
:::image type="content" source="media/confidential-client-application-authentication-error-aadsts7000218/grant-type.png" alt-text="Screenshot that shows a grant type" lightbox="media/confidential-client-application-authentication-error-aadsts7000218/grant-type.png":::
88
+
:::image type="content" source="media/confidential-client-application-authentication-error-aadsts7000218/grant-type.png" alt-text="Screenshot that shows a grant type.":::
89
89
90
-
Common OAuth 2.0 flows and their associated `grant_type` values are listed below:
90
+
Common OAuth 2.0 flows and their associated `grant_type` values are listed as follows:
0 commit comments