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

Remove invalid prompt for silent request instead of throwing an error #6895

Merged
merged 3 commits into from
Feb 15, 2024

Conversation

konstantin-msft
Copy link
Collaborator

  • Remove invalid prompt for silent request instead of throwing an error.

Fixes an issue when request prompt bleeds from msal-react MsalAuthenticationTemplate into ATS silentIframeClient.

@github-actions github-actions bot added the msal-browser Related to msal-browser package label Feb 14, 2024
);
delete request.prompt;
Copy link
Collaborator

@tnorling tnorling Feb 14, 2024

Choose a reason for hiding this comment

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

Objects are passed by reference so this can have unintended effects elsewhere - I suggest removing this and changing the logic below to prompt: request.prompt === PromptValue.NO_SESSION ? PromptValue.NO_SESSION : PromptValue.NONE

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alternatively you can spread the input object into a new object at the top of the function and then manipulate the new one as you wish

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. Fixed

if (
request.prompt &&
request.prompt !== PromptValue.NONE &&
request.prompt !== PromptValue.NO_SESSION
) {
throw createBrowserAuthError(
BrowserAuthErrorCodes.silentPromptValueError
this.logger.verbose(
Copy link
Collaborator

Choose a reason for hiding this comment

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

A higher log level seems appropriate here

Suggested change
this.logger.verbose(
this.logger.warning(

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@konstantin-msft konstantin-msft force-pushed the iframe_enforce_silent_prompt branch from 0a35206 to 2ab4829 Compare February 14, 2024 23:34
@konstantin-msft konstantin-msft merged commit db17cd0 into dev Feb 15, 2024
30 checks passed
@konstantin-msft konstantin-msft deleted the iframe_enforce_silent_prompt branch February 15, 2024 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
msal-browser Related to msal-browser package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants