@moriajs/auth
v0.4.39
Published
MoriaJS auth — JWT + httpOnly cookies, pluggable auth system
Readme
@moriajs/auth
Authentication plugin for MoriaJS.
Features
- JWT-based: Secure authentication using JSON Web Tokens.
- OAuth Support: Easy integration with GitHub, Google, and more.
- Auth Hooks:
requireAuthguard for routes.
Usage
import { authPlugin, requireAuth } from '@moriajs/auth';
await app.use(authPlugin({
secret: 'your-secret'
}));
// Guard a route
server.get('/me', { preHandler: [requireAuth] }, async (req) => {
return req.user;
});