Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the native account retrieval logic by adding validation for empty or invalid account filters. When no login hint or SID is provided, the code now properly falls back to using the active account's native account ID instead of attempting to filter with invalid criteria.
Key changes:
- Added validation in
CacheManager.getAccountInfoFilteredByto detect and handle empty/invalid account filters - Removed redundant filter validation from
AccountManager.getAccountsince it's now handled at the cache layer - Added test coverage for the new validation logic
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/msal-common/src/cache/CacheManager.ts | Added validation to return null and log a warning when account filter is empty or contains only falsy values |
| lib/msal-common/test/cache/CacheManager.spec.ts | Added test case verifying null is returned when filter has empty string values |
| lib/msal-browser/src/cache/AccountManager.ts | Removed duplicate empty filter check and simplified logging |
| lib/msal-browser/test/cache/BrowserCacheManager.spec.ts | Added test case verifying null is returned when filter has undefined values |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…AD/microsoft-authentication-library-for-js into v5_bugfix_getNativeAccount
|
This looks like it changes the behavior of the API, is this intended? |
Yes. This change is already present in v4. |
|
@lalimasharda I've opened a new pull request, #8420, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@lalimasharda I've opened a new pull request, #8421, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
change/@azure-msal-browser-f0c007ae-e311-4ceb-9576-4ddb9e737326.json
Outdated
Show resolved
Hide resolved
change/@azure-msal-common-034baa00-0efc-4248-b3c9-df6d476a271d.json
Outdated
Show resolved
Hide resolved
|
@lalimasharda I've opened a new pull request, #8422, to work on those changes. Once the pull request is ready, I'll request review from you. |
v5 PR for the getNativeAccountId bug fix (#7960)