bauth-js
Version:
A Node.js authentication library for API requests via remote authentication service using Bearer tokens. Compatible with Express and NestJS.
32 lines • 855 B
TypeScript
import { BAuthConfig, AuthResponse, ValidationResponse } from './types';
export declare class BAuth {
private config;
private client;
private token;
constructor(config: BAuthConfig);
/**
* Set the Bearer token for authentication
*/
setToken(token: string): void;
/**
* Get the current token
*/
getToken(): string | null;
/**
* Validate if the current token is valid
*/
validate(): Promise<ValidationResponse>;
/**
* Get authenticated user information
*/
user(): Promise<AuthResponse>;
/**
* Authenticate with a token and get user info
*/
authenticate(token: string): Promise<AuthResponse>;
/**
* Create a new instance with a token
*/
static withToken(token: string, config: BAuthConfig): BAuth;
}
//# sourceMappingURL=auth.d.ts.map