Handling authentication in Node.js often means juggling JWTs, cookies, and Redis manually β configuring middleware, managing sessions, and writing repetitive code.
auth-verify simplifies all that.
It provides a clean and modern way to manage JWT authentication, secure cookies, OTPs, and more β all with minimal setup.
const Auth = require("auth-verify");
const auth = new Auth({ jwtSecret: "MySecret" storeTokens: "redis" }); // or you can use 'memory' for saving your tokens in-memory
// Sign a JWT and set it automatically as an httpOnly cookie
await auth.jwt.sign({ userId: 1 }, "1h", { res });
// Verify the token (reads cookie automatically)
await auth.jwt.verify({ req });
β What happens under the hood:
- Token is generated and securely stored in Redis
- A safe, httpOnly cookie is automatically set on the response
- No need to manually use res.cookie() or middleware
- Works seamlessly with Express, Fastify, or any custom server setup
π§° Why Developers Love It
- Simple JWT management β sign, verify, revoke in one line
- Secure cookies β no cookie-parser needed
- Built-in Redis / memory token store
- Includes OTP system and sender support (e.g., Telegram, email, SMS)
- Works anywhere β Express, custom HTTP servers, even bots
π‘ Example: Minimal Login System
app.post("/login", async (req, res) => {
const token = await auth.jwt.sign({ userId: 1 }, "1h", { res });
res.json({ success: true, token });
});
app.get("/me", async (req, res) => {
const user = await auth.jwt.verify({ req });
res.json({ user });
});
Thatβs it.
No extra middleware. No manual cookie handling.
Just secure authentication with a clean API.
π¦ Install
npm install auth-verify
vπ Learn More
β¨ Summary
auth-verify gives you:
- JWT + Cookies + Redis in one simple API
- Secure authentication without boilerplate
- Full control when you need it
If you want a modern, simple, and flexible authentication solution β give auth-verify a try.
Top comments (0)