Skip to content

Commit c373be0

Browse files
adress build warnings
1 parent 4ff3f6b commit c373be0

File tree

7 files changed

+131
-23
lines changed

7 files changed

+131
-23
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: Issues on Internet Explorer & Microsoft Edge (MSAL.js)
3+
description: Learn about know issues when using the Microsoft Authentication Library for JavaScript (MSAL.js) with Internet Explorer and Microsoft Edge browsers.
4+
author: OwenRichards1
5+
manager: CelesteDG
6+
ms.author: owenrichards
7+
ms.custom: devx-track-js
8+
ms.date: 05/18/2020
9+
ms.reviewer: saeeda
10+
ms.service: active-directory
11+
ms.subservice: develop
12+
ms.topic: troubleshooting
13+
#Customer intent: As an application developer, I want to learn about issues with MSAL.js library so I can decide if this platform meets my application development needs and requirements.
14+
---
15+
16+
# Known issues on Internet Explorer and Microsoft Edge browsers (MSAL.js)
17+
18+
## Issues due to security zones
19+
We had multiple reports of issues with authentication in IE and Microsoft Edge (since the update of the *Microsoft Edge browser version to 40.15063.0.0*). We're tracking these and have informed the Microsoft Edge team. While Microsoft Edge works on a resolution, here's a description of the frequently occurring issues and the possible workarounds that can be implemented.
20+
21+
### Cause
22+
The cause for most of these issues is as follows. The session storage and local storage are partitioned by security zones in the Microsoft Edge browser. In this particular version of Microsoft Edge, when the application is redirected across zones, the session storage and local storage are cleared. Specifically, the session storage is cleared in the regular browser navigation, and both the session and local storage are cleared in the InPrivate mode of the browser. MSAL.js saves certain state in the session storage and relies on checking this state during the authentication flows. When the session storage is cleared, this state is lost and hence results in broken experiences.
23+
24+
### Issues
25+
26+
- **Infinite redirect loops and page reloads during authentication**. When users sign in to the application on Microsoft Edge, they're redirected back from the Microsoft Entra login page and are stuck in an infinite redirect loop resulting in repeated page reloads. This is usually accompanied by an `invalid_state` error in the session storage.
27+
28+
- **Infinite acquire token loops and AADSTS50058 error**. When an application that is run on Microsoft Edge tries to acquire a token for a resource, the application may get stuck in an infinite loop of the acquire token call. The following error is returned from Microsoft Entra ID in your network trace:
29+
30+
`Error :login_required; Error description:AADSTS50058: A silent sign-in request was sent but no user is signed in. The cookies used to represent the user's session were not sent in the request to Azure AD. This can happen if the user is using Internet Explorer or Edge, and the web app sending the silent sign-in request is in different IE security zone than the Azure AD endpoint (login.microsoftonline.com)`
31+
32+
- **Pop-up window doesn't close or is stuck when using login through pop-up window to authenticate**. When authenticating through a pop-up window in Microsoft Edge or IE (InPrivate), after entering credentials and signing in, if multiple domains across security zones are involved in the navigation, the pop-up window doesn't close because `MSAL.js` loses the handle to the pop-up window.
33+
34+
- **Cannot log in using redirect URL prefixed with tauri**. The only supported schemes for redirect URIs are `https:` for production apps and `http://localhost` for local development. If you attempt to use a different scheme, like `tauri://localhost`, for a mobile or desktop application, the below error message appears. This error arises as a result of how the backend of the SPA is designed.
35+
36+
`AADSTS90023: Cross-origin token redemption is permitted only for the 'Single-Page Application' client-type or 'Native' client-type with origin registered in AllowedOriginForNativeAppCorsRequestInOAuthToken allow list.`
37+
38+
### Update: Fix available in MSAL.js 0.2.3
39+
Fixes for the authentication redirect loop issues have been released in [MSAL.js 0.2.3](https://github.com/AzureAD/microsoft-authentication-library-for-js/releases). Enable the flag `storeAuthStateInCookie` in the MSAL.js config to take advantage of this fix. By default this flag is set to false.
40+
41+
When the `storeAuthStateInCookie` flag is enabled, MSAL.js uses the browser cookies to store the request state required for validation of the auth flows.
42+
43+
> [!NOTE]
44+
> This fix is not yet available for the `msal-angular` and `msal-angularjs` wrappers. This fix doesn't address the issue with pop-up windows.
45+
46+
#### Other workarounds
47+
Make sure to test that your issue is occurring only on the specific version of Microsoft Edge browser and works on the other browsers before adopting these workarounds.
48+
1. As a first step to get around these issues, ensure that the application ___domain and any other sites involved in the redirects of the authentication flow are added as trusted sites in the security settings of the browser. This ensures the redirects belong to the same security zone.
49+
To do so, follow these steps:
50+
- Open **Internet Explorer** and click on the **settings** (gear icon) in the top-right corner
51+
- Select **Internet Options**
52+
- Select the **Security** tab
53+
- Under the **Trusted Sites** option, click on the **sites** button and add the URLs in the dialog box that opens.
54+
55+
4. As mentioned before, since only the session storage is cleared during the regular navigation, you may configure MSAL.js to use the local storage instead. This can be set as the `cacheLocation` config parameter while initializing MSAL.
56+
57+
Note, these workarounds won't solve the issue for InPrivate browsing since both session and local storage are cleared.
58+
59+
## Issues due to popup blockers
60+
61+
There are cases when popups are blocked in IE or Microsoft Edge, for example when a second popup occurs during [multi-factor authentication](~/identity/authentication/concept-mfa-howitworks.md). You'll get an alert in the browser to allow for the pop-up window once or always. If you choose to allow, the browser opens the pop-up window automatically and returns a `null` handle for it. As a result, the library doesn't have a handle for the window and there's no way to close the pop-up window. The same issue doesn't happen in Chrome when it prompts you to allow pop-up windows because it doesn't automatically open a pop-up window.
62+
63+
As a **workaround**, developers need to allow popups in IE and Microsoft Edge before they start using their app to avoid this issue.
64+
65+
## Next steps
66+
Learn more about [Using MSAL.js in Internet Explorer](msal-js-use-ie-browser.md).

msal-javascript-conceptual/browser/migrate-adal-js-to-msal-js.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ ms.topic: how-to
2121
2222
## Prerequisites
2323

24-
- You must set the **Platform** / **Reply URL Type** to **Single-page application** on App Registration portal (if you have other platforms added in your app registration, such as **Web**, you need to make sure the redirect URIs don't overlap. See: [Redirect URI restrictions](./reply-url.md))
25-
- You must provide [polyfills](./msal-js-use-ie-browser.md) for ES6 features that MSAL.js relies on (for example, promises) in order to run your apps on **Internet Explorer**
26-
- Migrate your Microsoft Entra apps to [v2 endpoint](v2-overview.md) if you haven't already
24+
- You must set the **Platform** / **Reply URL Type** to **Single-page application** on App Registration portal (if you have other platforms added in your app registration, such as **Web**, you need to make sure the redirect URIs don't overlap. See: [Redirect URI restrictions](/entra/identity-platform/reply-url))
25+
- You must provide [polyfills](./use-ie-browser.md) for ES6 features that MSAL.js relies on (for example, promises) in order to run your apps on **Internet Explorer**
2726

2827
## Install and import MSAL
2928

@@ -226,21 +225,21 @@ const getAccessToken = async() => {
226225

227226
## Cache and retrieve tokens
228227

229-
Like ADAL.js, MSAL.js caches tokens and other authentication artifacts in browser storage, using the [Web Storage API](https://developer.mozilla.org/docs/Web/API/Web_Storage_API). You're recommended to use `sessionStorage` option (see: [configuration](#configure-msal)) because it's more secure in storing tokens that are acquired by your users, but `localStorage` will give you [Single Sign On](./msal-js-sso.md) across tabs and user sessions.
228+
Like ADAL.js, MSAL.js caches tokens and other authentication artifacts in browser storage, using the [Web Storage API](https://developer.mozilla.org/docs/Web/API/Web_Storage_API). You're recommended to use `sessionStorage` option (see: [configuration](#configure-msal)) because it's more secure in storing tokens that are acquired by your users, but `localStorage` will give you [Single Sign On](./single-sign-on.md) across tabs and user sessions.
230229

231230
Importantly, you aren't supposed to access the cache directly. Instead, you should use an appropriate MSAL.js API for retrieving authentication artifacts like access tokens or user accounts.
232231

233232
## Renew tokens with refresh tokens
234233

235-
ADAL.js uses the [OAuth 2.0 implicit flow](./v2-oauth2-implicit-grant-flow.md), which doesn't return refresh tokens for security reasons (refresh tokens have longer lifetime than access tokens and are therefore more dangerous in the hands of malicious actors). Hence, ADAL.js performs token renewal using a hidden IFrame so that the user isn't repeatedly prompted to authenticate.
234+
ADAL.js uses the [OAuth 2.0 implicit flow](/entra/identity-platform//v2-oauth2-implicit-grant-flow), which doesn't return refresh tokens for security reasons (refresh tokens have longer lifetime than access tokens and are therefore more dangerous in the hands of malicious actors). Hence, ADAL.js performs token renewal using a hidden IFrame so that the user isn't repeatedly prompted to authenticate.
236235

237236
With the auth code flow with PKCE support, apps using MSAL.js 2.x obtain refresh tokens along with ID and access tokens, which can be used to renew them. The usage of refresh tokens is abstracted away, and the developers aren't supposed to build logic around them. Instead, MSAL manages token renewal using refresh tokens by itself. Your previous token cache with ADAL.js won't be transferable to MSAL.js, as the token cache schema has changed and incompatible with the schema used in ADAL.js.
238237

239238
## Handle errors and exceptions
240239

241240
When using MSAL.js, the most common type of error you might face is the `interaction_in_progress` error. This error is thrown when an interactive API (`loginPopup`, `loginRedirect`, `acquireTokenPopup`, `acquireTokenRedirect`) is invoked while another interactive API is still in progress. The `login*` and `acquireToken*` APIs are *async* so you'll need to ensure that the resulting promises have resolved before invoking another one.
242241

243-
Another common error is `interaction_required`. This error is often resolved by initiating an interactive token acquisition prompt. For instance, the web API you're trying to access might have a [Conditional Access](~/identity/conditional-access/overview.md) policy in place, requiring the user to perform [multifactor authentication](~/identity/authentication/concept-mfa-howitworks.md) (MFA). In that case, handling `interaction_required` error by triggering `acquireTokenPopup` or `acquireTokenRedirect` will prompt the user for MFA, allowing them to fullfil it.
242+
Another common error is `interaction_required`. This error is often resolved by initiating an interactive token acquisition prompt. For instance, the web API you're trying to access might have a [Conditional Access](/entra/identity/conditional-access/overview) policy in place, requiring the user to perform [multifactor authentication](/entra/identity/authentication/concept-mfa-howitworks) (MFA). In that case, handling `interaction_required` error by triggering `acquireTokenPopup` or `acquireTokenRedirect` will prompt the user for MFA, allowing them to fullfil it.
244243

245244
Yet another common error you might face is `consent_required`, which occurs when permissions required for obtaining an access token for a protected resource aren't consented by the user. As in `interaction_required`, the solution for `consent_required` error is often initiating an interactive token acquisition prompt, using either `acquireTokenPopup` or `acquireTokenRedirect`.
246245

msal-javascript-conceptual/browser/performance.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ ms.author: emilylauber
1010
ms.reviewer: dmwendia, cwerner, owenrichards, kengaderdus
1111
---
1212

13-
# Performance
14-
15-
Please refer to [msal-common/performance](../../msal-common/docs/performance.md) first, which outlines the techniques your application can use to improve the performance of token acquisition using MSAL. Read below for measuring performance in your apps.
16-
17-
## Measuring performance
13+
# Measuring performance
1814

1915
Applications that want to measure the performance of authentication flows in MSAL.js can do so manually, or consume the performance measures taken by the library itself.
2016
Consuming performance measurements requires setting performance client in [telemetry configuration options](./configuration.md#telemetry-config-options) and adding performance callback.
@@ -45,8 +41,6 @@ const msalInstance = new PublicClientApplication({
4541
msalInstance.initialize();
4642
```
4743

48-
**Note**: You can pass your own performance telemetry client that implements [IPerformanceClient](../../msal-common/src/telemetry/performance/IPerformanceClient.ts) to customize telemetry management.
49-
5044
### Add performance callback
5145

5246
Applications can register a callback to receive performance measurements taken by the library. These measurement will include end-to-end measurements for top-level APIs, as well as measurements for important internal APIs.
@@ -91,7 +85,7 @@ const event: PerformanceEvent = {
9185
}
9286
```
9387

94-
The complete details for `PerformanceEvents` objects can be found [here](../../msal-common/src/telemetry/performance/PerformanceEvent.ts). Below is a list of some notable properties:
88+
The complete details for `PerformanceEvents` objects can be found [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-common/src/telemetry/performance/PerformanceClient.ts). Below is a list of some notable properties:
9589

9690
| **Property** | Type | Description |
9791
| ---------------------------------- | --------- | ---------------------------------------------------------------------- |

msal-javascript-conceptual/browser/prompt-behavior.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ In some cases however, the prompt value `none` can be used together with an inte
8282

8383
## Next steps
8484

85-
- [Single sign-on with MSAL.js](MIP-sso.md)
86-
- [Handle errors and exceptions in MSAL.js](MIP-errors.md)
85+
- [Single sign-on with MSAL.js](single-sign-on.md)
86+
- [Handle errors and exceptions in MSAL.js](errors.md)
8787
- [Handle ITP in Safari and other browsers where third-party cookies are blocked](/entra/identity-platform/reference-third-party-cookies-spas.md)
8888
- [OAuth 2.0 authorization code flow on the Microsoft identity platform](/entra/identity-platform/v2-oauth2-auth-code-flow.md)
8989
- [OpenID Connect on the Microsoft identity platform](/entra/identity-platform/v2-protocols-oidc.md)
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: Issues on Internet Explorer (MSAL.js)
3+
description: Use the Microsoft Authentication Library for JavaScript (MSAL.js) with Internet Explorer browser.
4+
author: OwenRichards1
5+
manager: CelesteDG
6+
ms.author: owenrichards
7+
ms.custom: devx-track-js
8+
ms.date: 12/01/2021
9+
ms.reviewer: saeeda
10+
ms.service: active-directory
11+
ms.subservice: develop
12+
ms.topic: conceptual
13+
#Customer intent: As an application developer, I want to learn about issues with MSAL.js library so I can decide if this platform meets my application development needs and requirements.
14+
---
15+
16+
# Known issues on Internet Explorer browsers (MSAL.js)
17+
18+
For better compatibility with Internet Explorer, we generate the Microsoft Authentication Library for JavaScript (MSAL.js) for [JavaScript ES5](https://262.ecma-international.org/5.1/), but there are other things to consider as you develop your application.
19+
20+
## Run an app in Internet Explorer
21+
22+
Internet Explorer lacks native support for JavaScript Promises, required by MSAL.js.
23+
24+
To support JavaScript Promises in an Internet Explorer app, reference a Promise polyfill before you reference MSAL.js.
25+
26+
```html
27+
<script
28+
src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js"
29+
class="pre"
30+
></script>
31+
```
32+
33+
## Debugging an application running in Internet Explorer
34+
35+
### Running in production
36+
37+
Deploying your application to production (for instance in Azure Web apps) normally works fine, provided the end user has accepted popups. We tested it with Internet Explorer 11.
38+
39+
### Running locally
40+
41+
To debug your application locally, temporarily disable Internet Explorer's _Protected Mode_ during your debugging session.
42+
43+
1. In Internet Explorer, select **Tools** > **Internet Options** > **Security** tab > **Internet** zone.
44+
1. Clear the **Enable Protected Mode (requires restarting Internet Explorer)** checkbox.
45+
1. Select **OK** to restart Internet Explorer.
46+
47+
When you're done debugging, follow the previous steps and select (instead of clear) the **Enable Protected Mode (requires restarting Internet Explorer)** checkbox.
48+
49+
## Next steps
50+
51+
Learn more about [Known issues when using MSAL.js in Internet Explorer](./known-issues-ie-edge-browsers.md).

msal-javascript-conceptual/browser/v1-migration.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ ms.reviewer: dmwendia, cwerner, owenrichards, kengaderdus
1212

1313
# Migrating from MSAL v1.x to MSAL v2.x
1414

15-
If you are new to MSAL, you should start [here](./initialization.md).
16-
17-
If you are coming from [MSAL v1.x](../../msal-common/), you can follow this guide to update your code to use [MSAL v2.x](../../msal-browser/).
15+
If you are new to MSAL, you should start [here](./initialization.md). If you are coming from MSAL v1.x, you can follow this guide to update your code to use MSAL v2.x
1816

1917
## 1. Update application registration
2018

21-
Go to the Azure AD portal for your tenant and review the App Registrations. You can create a [new registration](https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-spa-app-registration#create-the-app-registration) for MSAL 2.x or you can [update your existing registration](https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-spa-app-registration#redirect-uri-msaljs-20-with-auth-code-flow) for the registration that you are using for MSAL 1.x.
19+
Go to the Azure AD portal for your tenant and review the App Registrations. You can create a [new registration](/entra/identity-platform/scenario-spa-app-registration#create-the-app-registration) for MSAL 2.x or you can [update your existing registration](/entra/identity-platform/scenario-spa-app-registration#redirect-uri-msaljs-20-with-auth-code-flow) for the registration that you are using for MSAL 1.x.
2220

2321
## 2. Add the msal-browser package to your project
2422

msal-javascript-conceptual/browser/v2-migration.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ ms.reviewer: dmwendia, cwerner, owenrichards, kengaderdus
1414

1515
If you are new to MSAL, you should start [here](./initialization.md).
1616

17-
If you are coming from [MSAL v1.x](../../msal-core/), you should check [this guide](./v1-migration.md) first to migrate to [MSAL v2.x](../../msal-browser/) and then follow next steps.
17+
If you are coming from MSAL v1.x, you should check [this guide](./v1-migration.md) first to migrate to MSAL v2.x and then follow next steps.
1818

19-
If you are coming from [MSAL v2.x](../../msal-browser/), you can follow this guide to update your code to use [MSAL v3.x](../../msal-browser/).
19+
If you are coming from MSAL v2.x, you can follow this guide to update your code to use MSAL v3.x.
2020

2121
## Breaking changes
2222

@@ -90,7 +90,7 @@ const msalInstance = new msal.PublicClientApplication(msalConfig);
9090
await msalInstance.initialize();
9191
```
9292

93-
All other APIs are backward compatible with [MSAL v2.x](../../msal-browser/). It is recommended to take a look at the [default sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-browser-samples/VanillaJSTestApp2.0) to see a working example of MSAL v3.0.
93+
All other APIs are backward compatible with MSAL v2.x. It is recommended to take a look at the [default sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-browser-samples/VanillaJSTestApp2.0) to see a working example of MSAL v3.0.
9494

9595
### Crypto
9696

0 commit comments

Comments
 (0)