Web Client SDK Reference
The Glide Web Client SDK provides comprehensive functionality for handling authentication flows in web applications. Here's a detailed reference of its key components and APIs.
SDKClient Reference
Configuration Options
interface SDKConfig {
// Base URL for authentication endpoints
authUrl: string;
// Authentication method to use
method: 'iframe' | 'popup' | 'redirect';
// Optional redirect URI for redirect-based flow
redirectUri?: string;
// Popup window configuration
popupOptions?: {
width: number;
height: number;
};
// Request timeout in milliseconds
timeout?: number;
}
Authentication Methods
useAuth Hook
const {
token: string | null,
loading: boolean,
error: Error | null,
authenticate: (options?: AuthOptions) => Promise<void>
} = useAuth(config: SDKConfig)
Authentication Options
interface AuthOptions {
// Callback when authentication token is received
onTokenReceived?: (token: string) => void;
// Callback when authentication completes
onComplete?: (token: string) => void;
// Callback when authentication fails
onError?: (error: Error) => void;
}
Framework-Specific Exports
React Integration
import { useClient, useAuth } from 'glide-web-client-sdk/react'
Vue Integration
import { useClient, useAuth } from 'glide-web-client-sdk/vue'
Angular Integration
import { ClientService } from 'glide-web-client-sdk/angular'
Error Types
interface AuthError extends Error {
code: string;
details?: Record<string, any>;
}
enum ErrorCodes {
TIMEOUT = 'AUTH_TIMEOUT',
POPUP_BLOCKED = 'POPUP_BLOCKED',
INVALID_CONFIG = 'INVALID_CONFIG',
NETWORK_ERROR = 'NETWORK_ERROR',
USER_CANCELLED = 'USER_CANCELLED'
}
TypeScript Support
The SDK includes comprehensive TypeScript definitions out of the box. All interfaces, types, and enums are exported and can be imported directly:
import type {
SDKConfig,
AuthOptions,
AuthError,
AuthEvents
} from 'glide-web-client-sdk'