|
1 | 1 | --- |
2 | 2 | title: Script errors when running MSAL.Net in XBAP application with Internet Explorer |
3 | | -description: Provides solution to the script errors that occurs when running MSAL.Net in XBAP application with Microsoft Entra ID |
| 3 | +description: Provides a solution to the script error that occurs when you run MSAL.Net in an XBAP application that uses Microsoft Entra ID. |
4 | 4 | ms.date: 03/12/2025 |
5 | 5 | ms.reviewer: bachoang |
6 | 6 | ms.service: entra-id |
7 | 7 | ms.custom: sap:Developing or Registering apps with Microsoft identity platform |
8 | 8 | --- |
9 | | -# Cookies are disabled error in MSAL.Net XBAP application in Internet Explorer |
| 9 | +# "Cookies are disabled" error in MSAL.Net XBAP application in Internet Explorer |
10 | 10 |
|
11 | | -This article describes a problem in which a script error is returned when performing Microsoft Entra ID login by using an XAML Browser Application (XBAP) from Internet Explorer. |
| 11 | +This article describes a problem in which a script error is returned when you performing a Microsoft Entra ID login by using an XAML Browser Application (XBAP) from Microsoft Internet Explorer. |
12 | 12 |
|
13 | 13 | ## Symptoms |
14 | 14 |
|
15 | | -When you run Microsoft Authentication Library for .NET (MSAL.NET) codes similar to the following in a XAML Browser Application (XBAP) from Internet Explorer to perform Microsoft Entra ID login, you may receive a script error warning with the message **cookies are disabled**. |
| 15 | +You receive a script error warning and an error message that states that **cookies are disabled** when you perform a Microsoft Entra ID login by running Microsoft Authentication Library for .NET (MSAL.NET) codes that resemble the following codes in an XAML Browser Application (XBAP) from Internet Explorer: |
16 | 16 |
|
17 | 17 | ```C# |
18 | 18 | string tenantId = "<Tenant ID>"; |
|
62 | 62 | ``` |
63 | 63 | ## Cause |
64 | 64 |
|
65 | | -Although XBAP applications run within Internet Explorer, they operate in their own process space: **PresentationHost.exe**. This process is a highly secure container. XBAP applications use the WebBrowser control to host the Microsoft Entra ID login page. To minimize security risks from the browser surface, this container is configured with security restrictions which include blocking cookies. However, the Microsoft Entra ID login process depends on cookies, which causes a script error. |
| 65 | +Although XBAP applications run within Internet Explorer, they operate in their own process space: **PresentationHost.exe**. This process is a highly secure container. XBAP applications use the WebBrowser control to host the Microsoft Entra ID login page. To minimize security risks from the browser surface, this container is configured yo use security restrictions that include blocking cookies. However, the Microsoft Entra ID login process depends on cookies. This conflict causes a script error. |
66 | 66 |
|
67 | 67 | ## Solution |
68 | 68 |
|
69 | | -Configure MSAL.Net to use the [System Browser](/azure/active-directory/develop/msal-net-web-browsers#system-browser-experience-on-net) – Microsoft Edge to launch the Entra ID login page. Then, follow these steps to make the required updates: |
| 69 | +Configure MSAL.Net to use the [System Browser](/azure/active-directory/develop/msal-net-web-browsers#system-browser-experience-on-net) - Microsoft Edge to open the Entra ID login page. Then, follow these steps to make the required updates: |
70 | 70 |
|
71 | 71 | 1. In the Azure portal, locate your app in the **App registrations** page. Register `http://localhost` as a redirect URL under **Mobile and desktop applications** platform. |
72 | 72 |
|
73 | | - :::image type="content" source="./media/script-errors-running-msal-net-xbap-app/add-uri.png" alt-text="Application Manifest Key Credentials" lightbox="./media/script-errors-running-msal-net-xbap-app/add-uri.png"::: |
| 73 | + :::image type="content" source="./media/script-errors-running-msal-net-xbap-app/add-uri.png" alt-text="Screenshot that shows the localhost address being registered as a redirect URL" lightbox="./media/script-errors-running-msal-net-xbap-app/add-uri.png"::: |
74 | 74 |
|
75 | 75 | 2. Make the following change to your code: |
76 | 76 |
|
@@ -103,5 +103,4 @@ Configure MSAL.Net to use the [System Browser](/azure/active-directory/develop/m |
103 | 103 | }); |
104 | 104 | ``` |
105 | 105 |
|
106 | | -[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)] |
107 | | - |
| 106 | +[!INCLUDE [Azure Help Support](../../../includes/azure-help-support.md)] |
0 commit comments