UNPKG

@next-nest-auth/nestauth

Version:

NestAuth is an authentication solution for NestJS applications, designed to handle user login, session management, and token-based authentication (JWT). It integrates seamlessly with Next.js and other frontends to provide a unified authentication system,

42 lines (36 loc) 1.1 kB
import { Type } from "@nestjs/common"; export interface NestAuthModuleOptions { UserModule: Type<any>; UserService: Type<NestAuthInterface>; jwtSecret: string; jwtExpiresIn?: string; jwtRefreshTokenExpiresIn?: string; routePrefix?: string; } export type JwtPayloadType = { sub: number | string; name?: string; email?: string; username?: string; role?: string; pic?: string; macId?: string; [key: string]: number | string | boolean | undefined; } | null; export type SocialProfileType = { id: string; email: string; firstName: string; lastName: string; picture: string; accessToken: string; refreshToken: string; }; export type GoogleProfileType = SocialProfileType; export type FacebookProfileType = SocialProfileType; export interface NestAuthInterface { validateUser(params: any): Promise<JwtPayloadType>; getUserById(id: number | string): Promise<JwtPayloadType>; google?(params: GoogleProfileType): Promise<JwtPayloadType>; facebook?(params: FacebookProfileType): Promise<JwtPayloadType>; }