@authlink/client
Version:
Official client SDK for integrating with the Authlink Identity Provider
57 lines (56 loc) • 1.83 kB
JavaScript
export class IdentityProviderError extends Error {
constructor(message) {
super(message);
this.name = "IdentityProviderError";
}
}
export class StateMismatchError extends IdentityProviderError {
constructor() {
super("State returned by authorization server does not match the original request.");
this.name = "StateMismatchError";
}
}
export class SilentAuthorizationError extends IdentityProviderError {
constructor(code, description) {
super(description ?? "Silent authorization failed.");
this.name = code ?? "SilentAuthorizationError";
}
}
export class CodeVerifierMissingError extends IdentityProviderError {
constructor() {
super("PKCE code verifier is missing or expired.");
this.name = "CodeVerifierMissingError";
}
}
export class TokenExchangeError extends IdentityProviderError {
constructor(status, details) {
super(`Token exchange failed with status ${status}${details ? `: ${details}` : ''}`);
this.status = status;
this.details = details;
this.name = "TokenExchangeError";
}
}
export class NonceMissingError extends IdentityProviderError {
constructor() {
super("Nonce is missing or expired.");
this.name = "NonceMissingError";
}
}
export class IdTokenMissingError extends IdentityProviderError {
constructor() {
super("ID token is missing or expired.");
this.name = "IdTokenMissingError";
}
}
export class InvalidNonceError extends IdentityProviderError {
constructor() {
super("Nonce is invalid.");
this.name = "InvalidNonceError";
}
}
export class InvalidIdTokenError extends IdentityProviderError {
constructor() {
super("ID token is invalid.");
this.name = "InvalidIdTokenError";
}
}