Skip to content

MSAL 5.1.x: LoginPopup within iframe no longer works #8391

@Finrod24

Description

@Finrod24

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

5.4.0

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

5.1.1

Public or Confidential Client?

Public

Description

The standard configuration used in the sample found here works as long as the app is rendered in a top level Window:
https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/msal-angular-v5.1.1/samples/msal-angular-samples/angular-standalone-sample

Aso soon as i render this app in my parent window as iframe the loginPopup no longer works.
The behavior is as follows:

  1. The login window opens in a popup
  2. I login with the credential
  3. The popup closes
  4. The authentication response never returns to my app → broken

It seems that the broadcastResponseToMainFrame(...) does not find the main application, when it is hosted in an iframe.

Btw. i tried with relative and absolute URI in the redirectUri config parameter.

Error Message

No response

MSAL Logs

No response

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

{
      auth: {
        clientId: config.openIdConfig.clientId,
        authority: `https://login.microsoftonline.com/${config.openIdConfig.tenantId}`,
        redirectUri: 'https://localhost:4203/redirect',
        postLogoutRedirectUri: '/login',
      },
      cache: {
        cacheLocation: BrowserCacheLocation.LocalStorage,
      },
      system: {
        allowRedirectInIframe: true,
      },
    };

Relevant Code Snippets

Sample: https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/msal-angular-v5.1.1/samples/msal-angular-samples/angular-standalone-sample

Embedded in iframe

Reproduction Steps

  1. Use loginPupup
  2. The login window opens in a popup
  3. I login with the credential
  4. The popup closes
  5. The authentication response never returns to my app → broken

Expected Behavior

The authentication result is returned to the main app

Identity Provider

Entra ID (formerly Azure AD) / MSA

Browsers Affected (Select all that apply)

Chrome

Regression

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋Awaiting response from the MSAL.js teambug-unconfirmedA reported bug that needs to be investigated and confirmedmsal-angularRelated to @azure/msal-angular packagemsal-browserRelated to msal-browser packagepublic-clientIssues regarding PublicClientApplicationsquestionCustomer is asking for a clarification, use case or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions