UNPKG

@ouim/simple-logto

Version:

A simpler way to use @logto/react with prebuilt UI components and hooks for fast authentication setup

28 lines (27 loc) 1.01 kB
import type { AuthContext, VerifyAuthOptions, ExpressRequest, ExpressResponse, ExpressNext, NextRequest } from './types'; /** * Verify JWT token from Logto */ export declare function verifyLogtoToken(token: string, options: VerifyAuthOptions): Promise<AuthContext>; /** * Express middleware for Logto authentication */ export declare function createExpressAuthMiddleware(options: VerifyAuthOptions): (req: ExpressRequest, res: ExpressResponse, next: ExpressNext) => Promise<void | ExpressResponse>; /** * Next.js middleware for Logto authentication */ export declare function verifyNextAuth(request: NextRequest, options: VerifyAuthOptions): Promise<{ success: true; auth: AuthContext; } | { success: false; error: string; auth?: AuthContext; }>; /** * Generic verification function that can be used in any Node.js environment */ export declare function verifyAuth(tokenOrRequest: string | { cookies?: any; headers?: any; }, options: VerifyAuthOptions): Promise<AuthContext>;