Conversation
Member
Author
|
@copilot add PR description |
Merged
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a background SSO feature that automatically refreshes tokens after successful interactive authentication. When enabled via the new enableBackgroundSSO configuration option, MSAL will fire a fire-and-forget ssoSilent call after handleRedirectPromise and acquireTokenPopup complete successfully.
Changes:
- Added new
enableBackgroundSSOconfiguration option (defaults to false) - Implemented fire-and-forget background
ssoSilentcalls after interactive authentication - Added comprehensive telemetry tracking with new
BackgroundSsoSilentperformance event
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/msal-common/src/telemetry/performance/PerformanceEvent.ts | Added BackgroundSsoSilent performance event and telemetry abbreviation for tracking background SSO calls |
| lib/msal-browser/src/config/Configuration.ts | Added enableBackgroundSSO configuration option to BrowserAuthOptions with default value of false |
| lib/msal-browser/src/controllers/StandardController.ts | Implemented bkgdSsoSilent method using setTimeout for non-blocking execution, integrated into handleRedirectPromise and acquireTokenPopup flows |
| lib/msal-browser/test/app/PublicClientApplication.spec.ts | Added comprehensive test coverage for background SSO in both success and failure scenarios, feature flag validation, and fire-and-forget behavior verification |
| change/@azure-msal-common-461989e8-10b5-48f1-91dd-836248c3fce6.json | Beachball change file for msal-common package |
| change/@azure-msal-browser-440d27b3-88ff-459d-883e-a675b66d7976.json | Beachball change file for msal-browser package |
change/@azure-msal-common-461989e8-10b5-48f1-91dd-836248c3fce6.json
Outdated
Show resolved
Hide resolved
change/@azure-msal-browser-440d27b3-88ff-459d-883e-a675b66d7976.json
Outdated
Show resolved
Hide resolved
change/@azure-msal-common-461989e8-10b5-48f1-91dd-836248c3fce6.json
Outdated
Show resolved
Hide resolved
change/@azure-msal-browser-440d27b3-88ff-459d-883e-a675b66d7976.json
Outdated
Show resolved
Hide resolved
….json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…6.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Adds fire-and-forget `ssoSilent` calls after interactive authentication
(`acquireTokenPopup`, `handleRedirectPromise`) to proactively refresh
tokens in the background.
## Changes
- **Configuration**: Added `enableBackgroundSSO` boolean to
`BrowserAuthOptions` (default: `false`)
- **Implementation**: `bkgdSsoSilent()` method uses `setTimeout` to
defer SSO call until after interactive result returns, preventing
blocking
- **Telemetry**: New `BackgroundSsoSilent` performance event tracks
parent API, success/failure, and token sizes
## Usage
```typescript
const msalConfig = {
auth: {
clientId: "your-client-id",
authority: "https://login.microsoftonline.com/common",
enableBackgroundSSO: true // Enable background token refresh
}
};
const msalInstance = new PublicClientApplication(msalConfig);
// After popup or redirect completes, background ssoSilent fires automatically
const result = await msalInstance.acquireTokenPopup(request);
// Background SSO initiated - tokens refreshed silently without blocking return
```
Background calls fail silently with warning logs - they don't affect the
main authentication flow.
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
sameerag
commented
Jan 19, 2026
change/@azure-msal-browser-440d27b3-88ff-459d-883e-a675b66d7976.json
Outdated
Show resolved
Hide resolved
sameerag
commented
Jan 19, 2026
change/@azure-msal-common-461989e8-10b5-48f1-91dd-836248c3fce6.json
Outdated
Show resolved
Hide resolved
sameerag
commented
Jan 20, 2026
sameerag
commented
Jan 20, 2026
sameerag
commented
Jan 20, 2026
| */ | ||
| async refreshSession(request: SsoSilentRequest): Promise<boolean> { | ||
| this.performanceClient.addQueueMeasurement( | ||
| PerformanceEvents.SilentIframeClientAcquireToken, |
Member
Author
There was a problem hiding this comment.
Is there a need to make this synthentic, to not interfere in regular telemetry? If this is only for observability, may be we are okay? Confirm this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a background session refresh that automatically refreshes tokens after successful interactive authentication. When enabled via the new enableBackgroundSSO configuration option, MSAL will fire a fire-and-forget bkdgRefresh call after handleRedirectPromise and acquireTokenPopup complete successfully.
Changes: