UNPKG

bauth-js

Version:

A Node.js authentication library for API requests via remote authentication service using Bearer tokens. Compatible with Express and NestJS.

13 lines 750 B
import { Request, Response, NextFunction } from 'express'; import { BAuthConfig } from '../types'; export interface BAuthExpressOptions extends BAuthConfig { onUnauthorized?: (req: Request, res: Response, next: NextFunction) => void; userProperty?: string; tokenExtractor?: (req: Request) => string | null; } export declare function createBAuthMiddleware(options: BAuthExpressOptions): (req: any, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>; /** * Convenience function for basic Express middleware */ export declare function bauth(config: BAuthConfig): (req: any, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>; //# sourceMappingURL=express.d.ts.map