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

[msal-common][msal-browser] Add support for sub error codes #1533

Merged
merged 19 commits into from May 7, 2020

Conversation

tnorling
Copy link
Collaborator

@tnorling tnorling commented Apr 22, 2020

This PR builds on #1451 and will close #1348

It adds support for sub-error codes returned from the /token endpoint indicating that interaction is required

@coveralls
Copy link

coveralls commented Apr 23, 2020

Coverage Status

Coverage increased (+0.05%) to 79.562% when pulling 6091745 on msal-common-sub-errors into 990682a on dev.

@tnorling tnorling marked this pull request as ready for review April 24, 2020 21:52
static isInteractionRequiredError(errorCode: string, errorString: string, subError?: string) : boolean {
const isInteractionRequiredErrorCode = !StringUtils.isEmpty(errorCode) && Object.values(InteractionRequiredAuthErrorMessage).includes(errorCode);
const isInteractionRequiredSubError = !StringUtils.isEmpty(subError) && Object.values(InteractionRequiredAuthSubErrorMessage).includes(subError);
const isInteractionRequiredErrorDesc = !StringUtils.isEmpty(errorString) && Object.values(InteractionRequiredAuthErrorMessage).some((irErrorCode) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Object.values is not supported in IE: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values

I'm not sure if Typescript provides a polyfill, can you check to see if this works in IE11?

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 to know. Will look into it.

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

lib/msal-common/src/error/InteractionRequiredAuthError.ts Outdated Show resolved Hide resolved
@tnorling tnorling requested a review from jasonnutter May 7, 2020 18:20
Copy link
Contributor

@jasonnutter jasonnutter left a comment

Choose a reason for hiding this comment

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

Looks good!

@tnorling tnorling merged commit dacad07 into dev May 7, 2020
@tnorling tnorling deleted the msal-common-sub-errors branch May 28, 2020 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

msal-common supports sub-error codes
4 participants