UNPKG

@auth0/nextjs-auth0

Version:
158 lines (157 loc) 4.92 kB
import { SdkError } from "./sdk-error.js"; /** * Errors that come from Auth0 in the `redirect_uri` callback may contain reflected user input via the OpenID Connect `error` and `error_description` query parameter. * You should **not** render the error `message`, or `error` and `error_description` properties without properly escaping them first. */ export declare class OAuth2Error extends SdkError { code: string; constructor({ code, message }: { code: string; message?: string; }); } export declare class DiscoveryError extends SdkError { code: string; constructor(message?: string); } export declare class MissingStateError extends SdkError { code: string; constructor(message?: string); } export declare class InvalidStateError extends SdkError { code: string; constructor(message?: string); } export declare class InvalidConfigurationError extends SdkError { code: string; constructor(message?: string); } export declare class AuthorizationError extends SdkError { code: string; cause: OAuth2Error; constructor({ cause, message }: { cause: OAuth2Error; message?: string; }); } export declare class AuthorizationCodeGrantRequestError extends SdkError { code: string; constructor(message?: string); } export declare class AuthorizationCodeGrantError extends SdkError { code: string; cause: OAuth2Error; constructor({ cause, message }: { cause: OAuth2Error; message?: string; }); } export declare class BackchannelLogoutError extends SdkError { code: string; constructor(message?: string); } export declare class BackchannelAuthenticationNotSupportedError extends SdkError { code: string; constructor(); } export declare class BackchannelAuthenticationError extends SdkError { code: string; cause?: OAuth2Error; constructor({ cause }: { cause?: OAuth2Error; }); } export declare enum AccessTokenErrorCode { MISSING_SESSION = "missing_session", MISSING_REFRESH_TOKEN = "missing_refresh_token", FAILED_TO_REFRESH_TOKEN = "failed_to_refresh_token" } export declare class AccessTokenError extends SdkError { code: string; cause?: OAuth2Error; constructor(code: string, message: string, cause?: OAuth2Error); } /** * Enum representing error codes related to access tokens for connections. */ export declare enum AccessTokenForConnectionErrorCode { /** * The session is missing. */ MISSING_SESSION = "missing_session", /** * The refresh token is missing. */ MISSING_REFRESH_TOKEN = "missing_refresh_token", /** * Failed to exchange the refresh token. */ FAILED_TO_EXCHANGE = "failed_to_exchange_refresh_token" } /** * Error class representing an access token for connection error. * Extends the `SdkError` class. */ export declare class AccessTokenForConnectionError extends SdkError { /** * The error code associated with the access token error. */ code: string; cause?: OAuth2Error; /** * Constructs a new `AccessTokenForConnectionError` instance. * * @param code - The error code. * @param message - The error message. * @param cause - The OAuth2 cause of the error. */ constructor(code: string, message: string, cause?: OAuth2Error); } /** * Error codes for Custom Token Exchange errors. */ export declare enum CustomTokenExchangeErrorCode { /** * The subject_token is missing or empty. */ MISSING_SUBJECT_TOKEN = "missing_subject_token", /** * The subject_token_type is not a valid URI, wrong length, or uses a reserved namespace. */ INVALID_SUBJECT_TOKEN_TYPE = "invalid_subject_token_type", /** * The actor_token was provided without actor_token_type. */ MISSING_ACTOR_TOKEN_TYPE = "missing_actor_token_type", /** * The token exchange request failed. */ EXCHANGE_FAILED = "exchange_failed" } /** * Error class representing a Custom Token Exchange error. * Extends the `SdkError` class. * * This error is thrown when a Custom Token Exchange operation fails, * such as validation errors or server-side token exchange failures. * * @see {@link https://auth0.com/docs/authenticate/custom-token-exchange Auth0 Custom Token Exchange Documentation} */ export declare class CustomTokenExchangeError extends SdkError { /** * The error code associated with the custom token exchange error. */ code: string; /** * The underlying OAuth2 error that caused this error (if applicable). */ cause?: OAuth2Error; /** * Constructs a new `CustomTokenExchangeError` instance. * * @param code - The error code. * @param message - The error message. * @param cause - The OAuth2 cause of the error. */ constructor(code: string, message: string, cause?: OAuth2Error); }