msal
Version:
Microsoft Authentication Library for js
49 lines • 2.23 kB
JavaScript
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { __extends } from "tslib";
import { ServerError } from "./ServerError";
export var InteractionRequiredAuthErrorMessage = {
interactionRequired: {
code: "interaction_required"
},
consentRequired: {
code: "consent_required"
},
loginRequired: {
code: "login_required"
},
};
/**
* Error thrown when the user is required to perform an interactive token request.
*/
var InteractionRequiredAuthError = /** @class */ (function (_super) {
__extends(InteractionRequiredAuthError, _super);
function InteractionRequiredAuthError(errorCode, errorMessage) {
var _this = _super.call(this, errorCode, errorMessage) || this;
_this.name = "InteractionRequiredAuthError";
Object.setPrototypeOf(_this, InteractionRequiredAuthError.prototype);
return _this;
}
InteractionRequiredAuthError.isInteractionRequiredError = function (errorString) {
var interactionRequiredCodes = [
InteractionRequiredAuthErrorMessage.interactionRequired.code,
InteractionRequiredAuthErrorMessage.consentRequired.code,
InteractionRequiredAuthErrorMessage.loginRequired.code
];
return errorString && interactionRequiredCodes.indexOf(errorString) > -1;
};
InteractionRequiredAuthError.createLoginRequiredAuthError = function (errorDesc) {
return new InteractionRequiredAuthError(InteractionRequiredAuthErrorMessage.loginRequired.code, errorDesc);
};
InteractionRequiredAuthError.createInteractionRequiredAuthError = function (errorDesc) {
return new InteractionRequiredAuthError(InteractionRequiredAuthErrorMessage.interactionRequired.code, errorDesc);
};
InteractionRequiredAuthError.createConsentRequiredAuthError = function (errorDesc) {
return new InteractionRequiredAuthError(InteractionRequiredAuthErrorMessage.consentRequired.code, errorDesc);
};
return InteractionRequiredAuthError;
}(ServerError));
export { InteractionRequiredAuthError };
//# sourceMappingURL=InteractionRequiredAuthError.js.map