Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSOSilient isn't working #7330

Open
2 tasks
luke-nguyen-ams opened this issue Sep 22, 2024 · 2 comments
Open
2 tasks

SSOSilient isn't working #7330

luke-nguyen-ams opened this issue Sep 22, 2024 · 2 comments
Labels
b2c Related to Azure B2C library-specific issues bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-browser Related to msal-browser package msal-react Related to @azure/msal-react Needs: Author Feedback Awaiting response from issue author no-issue-activity Issue author has not responded in 5 days public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@luke-nguyen-ams
Copy link

luke-nguyen-ams commented Sep 22, 2024

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

3.24.0

Wrapper Library

MSAL React (@azure/msal-react)

Wrapper Library Version

2.1.0

Public or Confidential Client?

Public

Description

image

While integrating my website into a parent website that uses Azure B2C, I encountered an issue when attempting Single Sign-On (SSO). After successfully logging into the parent website, I posted a message to an iframe containing the active account. However, when trying to authenticate using the SSOSilent method with loginHint and the active account, an error was thrown:

InteractionRequiredAuthError: interaction_required: AADB2C90077: User does not have an existing session and request prompt parameter has a value of 'None'

The error indicates that the user does not have an existing session, although they are already logged into the parent website. I expected the session to persist across iframes for seamless SSO, but this seems to require interaction despite the prompt parameter being set to 'None.'

With SID, i saw it is not available with B2C: #1935

Here is my code in Iframe website:

const ssoSilent = async (account: AccountInfo): Promise<string> => {
   try {
     await instance.acquireTokenRedirect({
       scopes: MicrosoftGraphAuth.GetLoginRequest().scopes,
       account: account,
     });
     const result = await instance.ssoSilent({
       scopes: ['client_id', 'offline_access', 'openid'],
       loginHint: account.username,
     });
     const {accessToken} = result;
     localStorage.setItem('accessToken', JSON.stringify(accessToken));
     return accessToken;
   } catch (error) {
     console.log('error acquire token silent', error);
     instance.clearCache();
   }
};

Docs: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/iframe-usage.md#single-sign-on

Error Message

InteractionRequiredAuthError: interaction_required: AADB2C90077: User does not have an existing session and request prompt parameter has a value of 'None'.
Correlation ID: 2fc57a11-158f-476a-8ce4-18843fb12fe6

MSAL Logs

No response

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

const msalConfig: Configuration = {
      auth: {
        clientId: 'eadcd102-392c-45a3-xxxxxx-xxxxxxxxxx',
        authority: 'https://xxxxxxx.b2clogin.com/amsb2cdera.onmicrosoft.com/B2C_1_signup',
        redirectUri: 'http://localhost:8080/oauth2/microsoft/callback',
        knownAuthorities: ['xxxxxxx.b2clogin.com'],
      },
      cache: {
        cacheLocation: 'localStorage', 
      },
    };

Relevant Code Snippets

const iframe: any = document.getElementById('child-iframe')
iframe?.contentWindow?.postMessage(accounts[0], '*')

Reproduction Steps

  1. Logged in Parent website
  2. Parent website call postMessage() send data to iframe (https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage)
  3. Got error when use instance.ssoSilent()

Expected Behavior

ssoSilent successfully

Identity Provider

Azure B2C Custom Policy

Browsers Affected (Select all that apply)

Chrome, Firefox, Edge, Safari, Other

Regression

"@azure/msal-browser": "3.24.0" and "@azure/msal-react": "2.1.0",

Source

External (Customer)

@luke-nguyen-ams luke-nguyen-ams added bug-unconfirmed A reported bug that needs to be investigated and confirmed question Customer is asking for a clarification, use case or information. labels Sep 22, 2024
@github-actions github-actions bot added b2c Related to Azure B2C library-specific issues msal-browser Related to msal-browser package msal-react Related to @azure/msal-react public-client Issues regarding PublicClientApplications labels Sep 22, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Sep 22, 2024
@sameerag
Copy link
Member

This is something the B2C team can answer, we do not yet custom brokering scenarios from MSAL JS. Please raise a ticket with B2C team here.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Author Feedback Awaiting response from issue author and removed Needs: Attention 👋 Awaiting response from the MSAL.js team labels Sep 24, 2024
Copy link
Contributor

@luke-nguyen-ams This issue has been automatically marked as stale because it is marked as requiring author feedback but has not had any activity for 5 days. If your issue has been resolved please let us know by closing the issue. If your issue has not been resolved please leave a comment to keep this open. It will be closed automatically in 7 days if it remains stale.

@microsoft-github-policy-service microsoft-github-policy-service bot added the no-issue-activity Issue author has not responded in 5 days label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b2c Related to Azure B2C library-specific issues bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-browser Related to msal-browser package msal-react Related to @azure/msal-react Needs: Author Feedback Awaiting response from issue author no-issue-activity Issue author has not responded in 5 days public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

2 participants