UNPKG

@oa2/core

Version:

A comprehensive, RFC-compliant OAuth 2.0 authorization server implementation in TypeScript

92 lines (89 loc) 3.64 kB
import { OAuth2ErrorCode } from './types.js'; /** * Default Descriptions */ declare const defaultErrorDescriptions: Record<OAuth2ErrorCode, string>; /** * Base class for all OAuth2 related errors. */ declare class OAuth2Error extends Error { readonly code: OAuth2ErrorCode; readonly description?: string; readonly statusCode: number; constructor(code: OAuth2ErrorCode, description?: string, statusCode?: number); } /** * Represents an 'invalid_request' error as per OAuth2 specification. * This error indicates that the request is missing a required parameter, * includes an invalid parameter value, includes a parameter more than once, * or is otherwise malformed. */ declare class InvalidRequestError extends OAuth2Error { constructor(description?: string); } /** * Represents an 'unauthorized_client' error as per OAuth2 specification. * This error indicates that the client is not authorized to request an authorization * code using this method. */ declare class UnauthorizedClientError extends OAuth2Error { constructor(description?: string); } /** * Represents an 'access_denied' error as per OAuth2 specification. * This error indicates that the resource owner or authorization server denied the request. */ declare class AccessDeniedError extends OAuth2Error { constructor(description?: string); } /** * Represents an 'unsupported_response_type' error as per OAuth2 specification. * This error indicates that the authorization server does not support * obtaining an authorization code using this response type. */ declare class UnsupportedResponseTypeError extends OAuth2Error { constructor(description?: string); } /** * Represents an 'invalid_scope' error as per OAuth2 specification. * This error indicates that the requested scope is invalid, unknown, or malformed. */ declare class InvalidScopeError extends OAuth2Error { constructor(description?: string); } /** * Represents a 'server_error' as per OAuth2 specification. * This error indicates that the authorization server encountered an unexpected * condition that prevented it from fulfilling the request. */ declare class ServerError extends OAuth2Error { constructor(description?: string); } /** * Represents a 'temporarily_unavailable' error as per OAuth2 specification. * This error indicates that the authorization server is currently unable to handle * the request due to a temporary overloading or maintenance of the server. */ declare class TemporarilyUnavailableError extends OAuth2Error { constructor(description?: string); } /** * Represents an 'invalid_grant' error as per OAuth2 specification. * This error indicates that the provided authorization grant (e.g., authorization code, * refresh token) or the refresh token is invalid, expired, revoked, does not match the * redirection URI used in the authorization request, or was issued to another client. */ declare class InvalidGrantError extends OAuth2Error { constructor(description?: string); } /** * Represents an 'unsupported_grant_type' error as per OAuth2 specification. * This error indicates that the authorization grant type is not supported by the * authorization server. * @see RFC 6749, Section 5.2 Error Response */ declare class UnsupportedGrantTypeError extends OAuth2Error { constructor(description?: string); } export { AccessDeniedError, InvalidGrantError, InvalidRequestError, InvalidScopeError, OAuth2Error, ServerError, TemporarilyUnavailableError, UnauthorizedClientError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, defaultErrorDescriptions }; //# sourceMappingURL=errors.d.ts.map