Skip to content

Create the msal-custom-auth package for supporting the external ID authentication (sign-in, sign-up and SSPR) #7599

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

Open
wants to merge 109 commits into
base: dev
Choose a base branch
from

Conversation

shenj
Copy link

@shenj shenj commented Feb 26, 2025

The changes in this PR include:

  • Create the msal-custom-auth package for supporting the external ID authentication (sign-in, sign-up and SSPR).
  • integrate the msal-custom-auth package into the pipelines
  • Expose more components from msal-browser which are used by the new package msal-custom-auth.

@github-actions github-actions bot added the extensions Related to extensions for the base libraries label Apr 2, 2025
@github-actions github-actions bot removed msal-angular Related to @azure/msal-angular package msal-node Related to msal-node package msal-common Related to msal-common package msal-react Related to @azure/msal-react extensions Related to extensions for the base libraries labels Apr 2, 2025
@shenj shenj marked this pull request as ready for review April 8, 2025 13:35
@shenj shenj changed the title Custom auth/main Create the msal-custom-auth package for the external ID authentication (sign-in, sign-up and SSPR) Apr 8, 2025
@shenj shenj changed the title Create the msal-custom-auth package for the external ID authentication (sign-in, sign-up and SSPR) Create the msal-custom-auth package for supporting the external ID authentication (sign-in, sign-up and SSPR) Apr 8, 2025
@@ -22,7 +22,7 @@ resources:
- repository: 1P
type: git
name: IDDP/msal-javascript-1p
ref: master
ref: custom-auth/pipeline # TODO: change back to master after pipeline is working
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will be reverted after the ADO PR is completed.

@@ -50,7 +54,7 @@ resources:
- repository: 1P
type: git
name: IDDP/msal-javascript-1p
ref: master
ref: custom-auth/pipeline # TODO: change back to master after pipeline is working
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will be reverted after the ADO PR is completed.

This PR is to add support for web fallback for (sign-up, sign-in, reset
password) flows.
1. Existing code already check during those flows if challenge types is
`redirect `only. In this case, user could check this condition from
state, and handle it.
2. By default, user could reuse the built-in `popUpLogin` from MSAL JS
to continue to flow with a pop up interactively.
3. Make sure challenge type at least contains `redirect`.
@@ -18,6 +18,7 @@ export {
} from "./app/PublicClientApplication.js";
export { PublicClientNext } from "./app/PublicClientNext.js";
export { IController } from "./controllers/IController.js";
export { StandardController } from "./controllers/StandardController.js";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't add these exports, these are internal to msal-browser and are not API stable, thus not intended to be public. Let's figure out how we can enable your scenarios in a way that uses the existing public surface where possible and expose new APIs that can be properly supported where the existing APIs have gaps. Feel free to reach out if you have questions on this.

try {
this.logger.verbose("Starting silent flow to acquire token from cache", this.correlationId);

const result = await silentFlowClient.acquireCachedToken(silentRequest);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be changed to <PublicClientApplication instance>.acquireTokenSilent({...silentRequest, cacheLookupPolicy: CacheLookupPolicy.AccessToken})


this.logger.verbose("Starting refresh flow to refresh token", this.correlationId);

const refreshTokenResult = await refreshTokenClient.acquireTokenByRefreshToken(silentRequest);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be changed to <PublicClientApplication instance>.acquireTokenSilent({...silentRequest, cacheLookupPolicy: CacheLookupPolicy.RefreshToken})

}
}

override async logout(logoutRequest?: ClearCacheRequest): Promise<void> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason you can't use the existing logoutRedirect API as-is?


this.logger.verbose("Getting the first account from cache.", correlationId);

const allAccounts = this.browserStorage.getAllAccounts();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be changed to <PublicClientApplication instance>.getAllAccounts()

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label May 5, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs: Attention 👋 Awaiting response from the MSAL.js team label May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Related to documentation. msal-browser Related to msal-browser package samples Related to the samples apps for the library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants