Standardized authentication error types

Abstracts provider-specific error names (like "BrowserAuthError", "InteractionRequiredAuthError") into semantic categories that application code can handle consistently.

This eliminates the need for consumers to check provider-specific error properties like err.name === 'BrowserAuthError'.

Example

try {
await this.authBase.login();
} catch (err) {
const authError = this.authBase.classifyError(err);

switch (authError.type) {
case AuthErrorType.TOKEN_EXPIRED:
this.showMessage('Session expired. Please log in again.');
break;
case AuthErrorType.USER_CANCELLED:
// User cancelled - don't show error
break;
default:
this.showError(authError.userMessage);
}
}

Enumeration Members

CONFIGURATION_ERROR: "CONFIGURATION_ERROR"

Invalid configuration or setup error

Usually indicates a problem with the auth provider configuration (wrong client ID, invalid redirect URI, etc.)

INTERACTION_REQUIRED: "INTERACTION_REQUIRED"

User interaction required (e.g., consent, MFA)

Mapped from:

  • Auth0: "consent_required", "interaction_required"
  • MSAL: InteractionRequiredAuthError
  • Okta: "consent_required"
NETWORK_ERROR: "NETWORK_ERROR"

Network error communicating with auth provider

Could be DNS failure, timeout, or other connectivity issues.

NO_ACTIVE_SESSION: "NO_ACTIVE_SESSION"

No active user session found - user needs to log in

Mapped from:

  • Auth0: "login_required", "no active session"
  • MSAL: BrowserAuthError (no accounts)
  • Okta: "login_required"
TOKEN_EXPIRED: "TOKEN_EXPIRED"

Token has expired - user needs to refresh or re-authenticate

Mapped from:

  • Auth0: "jwt expired", "token expired"
  • MSAL: InteractionRequiredAuthError (when token expired)
  • Okta: "token_expired"
UNKNOWN_ERROR: "UNKNOWN_ERROR"

Generic/unknown error

Used when the error doesn't fit into any other category. The error message and originalError should provide more details.

USER_CANCELLED: "USER_CANCELLED"

User cancelled the authentication flow

Typically doesn't require showing an error message to the user, as the cancellation was intentional.