UNPKG

@coolio/auth-interceptor

Version:
22 lines (21 loc) 1.06 kB
import { HttpFetch, HttpInterceptorInterface, HttpResponse, NormalizedHttpOptions } from '@coolio/http'; import { AuthInterceptorOptions } from './authInterceptor.types'; export declare const hasUnauthorizedResponseCode: (response: HttpResponse<any>) => boolean; export declare const isUnauthorizedError: (error: any) => boolean; export declare class AuthInterceptor implements HttpInterceptorInterface { private readonly options; private readonly queue; constructor(options: AuthInterceptorOptions); readonly pendingRequestCount: number; onIntercept<Body>(request: HttpFetch<Body>, options: NormalizedHttpOptions): HttpFetch<Body>; private requestReauthorization; /** * Called when: * - reauthorization fails, * - a second request fails after reauthorization */ private handleAuthorizationError; private handleUnauthorizedResponse; } export declare const createAuthInterceptor: (options: AuthInterceptorOptions) => AuthInterceptor; //# sourceMappingURL=authInterceptor.d.ts.map