Skip to content

Move auth error messages out of the bundle#7744

Merged
konstantin-msft merged 8 commits into
msal-v5from
move_error_message_to_markdown
May 21, 2025
Merged

Move auth error messages out of the bundle#7744
konstantin-msft merged 8 commits into
msal-v5from
move_error_message_to_markdown

Conversation

@konstantin-msft

Copy link
Copy Markdown
Collaborator
  • Move auth error messages out of the bundle

@github-actions github-actions Bot added documentation Related to documentation. msal-node Related to msal-node package msal-browser Related to msal-browser package msal-common Related to msal-common package labels May 12, 2025
@konstantin-msft konstantin-msft marked this pull request as ready for review May 13, 2025 18:29
Comment thread lib/msal-common/src/error/AuthError.ts Outdated
tnorling
tnorling previously approved these changes May 14, 2025

@tnorling tnorling left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd also like to see some sort of CI validation that a message actually exists in the doc for all error codes. I'm happy to treat that as its own separate work item, however, just calling it out as a requirement to call this work complete.

@konstantin-msft

Copy link
Copy Markdown
Collaborator Author

I'd also like to see some sort of CI validation that a message actually exists in the doc for all error codes. I'm happy to treat that as its own separate work item, however, just calling it out as a requirement to call this work complete.

Will address this in a follow-up PR

Comment thread docs/errors.md Outdated
tnorling
tnorling previously approved these changes May 20, 2025
Comment thread lib/msal-browser/src/error/BrowserAuthError.ts
@konstantin-msft konstantin-msft enabled auto-merge (rebase) May 20, 2025 22:03
@konstantin-msft konstantin-msft merged commit 71336db into msal-v5 May 21, 2025
8 checks passed
@konstantin-msft konstantin-msft deleted the move_error_message_to_markdown branch May 21, 2025 18:13

@jo-arroyo jo-arroyo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi, I know this is merged already, but I noticed some potentially broken links that may need to be addressed in a separate PR, and there are some other suggestions that you can choose to take or not.

Comment thread docs/errors.md
- Exceeded cache storage capacity.

**[Other](#other)**
This error occurs when MSAL.js surpasses the allotted storage limit when attempting to save token information in the [configured cache storage](./caching.md#cache-storage). See [here](https://developer.mozilla.org/en-US/docs/Web/API/Storage_API/Storage_quotas_and_eviction_criteria#web_storage) for web storage limits.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The link to the caching doc may need to be changed now that this doc has been moved out of msal-browser

Comment thread docs/errors.md

**Mitigation**:

1. Make sure the configured cache storage has enough capacity to allow MSAL.js to persist token payload. The amount of cache storage required depends on the number of [cached artifacts](./caching.md#cached-artifacts).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here for caching doc

Comment thread docs/errors.md
**Mitigation**:

1. Make sure the configured cache storage has enough capacity to allow MSAL.js to persist token payload. The amount of cache storage required depends on the number of [cached artifacts](./caching.md#cached-artifacts).
2. Disable [claimsBasedCachingEnabled](./configuration.md#cache-config-options) cache config option. When enabled, it caches access tokens under a key containing the hash of the requested claims. Depending on the MSAL.js API usage, it may result in the vast number of access tokens persisted in the cache storage.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here for configuration doc

Comment thread docs/errors.md
- Nonce mismatch error.

### `auth_time_not_found`
- Max Age was requested and the ID token is missing the auth_time variable auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Max Age was requested and the ID token is missing the auth_time variable auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.
- Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.

Comment thread docs/errors.md
- The provided authority does not support logout.

### `key_id_missing`
- A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.
- A keyId value is missing from the requested bound token's cache record and is required to match the token to its stored binding key.

import { TestTimeUtils } from "msal-test-utils";
import { PopupRequest } from "../../src/request/PopupRequest.js";
import { emptyNavigateUri } from "../../src/error/BrowserAuthErrorCodes.js";
import { getDefaultErrorMessage } from "../../src/error/BrowserAuthError.js";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be combined with the import on line 59 above?

TestTimeUtils,
} from "msal-test-utils";
import { BrowserPerformanceClient } from "../../src/telemetry/BrowserPerformanceClient.js";
import { getDefaultErrorMessage } from "../../src/error/BrowserAuthError.js";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this be combined with the import on line 69 above?

import { AuthenticationResult } from "../../src/response/AuthenticationResult.js";
import { SilentRequest } from "../../src/request/SilentRequest.js";
import { SsoSilentRequest } from "../../src/index.js";
import { getDefaultErrorMessage } from "../../src/error/BrowserAuthError.js";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same with import here

createClientAuthError,
} from "../../src/error/ClientAuthError";
import { AuthError } from "../../src/error/AuthError";
import { getDefaultErrorMessage } from "../../src/error/AuthError.js";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Combine with line above?

createJoseHeaderError,
} from "../../src/error/JoseHeaderError";
import { AuthError } from "../../src/error/AuthError";
import { getDefaultErrorMessage } from "../../src/error/AuthError.js";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Combine with above line

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 msal-common Related to msal-common package msal-node Related to msal-node package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants