Stop WritingAuth CodeOver and Over
AuthFlow handles login, token management, and API calls automatically. Works everywhere - browsers, Node.js, React Native, and SSR environments.
npm install @jmndao/auth-flow
// Manual token management localStorage.setItem('token', response.data.token); // Manual refresh logic if (error.status === 401) { // Handle token refresh... const refreshToken = localStorage.getItem('refresh'); // More boilerplate code... } // Manual cookie handling document.cookie = `token=${token}; path=/`;
const auth = createAuthFlow(config); await auth.login(credentials); // Just works - automatic refresh, storage, etc. const data = await auth.get('/api/profile');
Everything You Need for
Modern Auth
Stop reinventing the wheel. AuthFlow provides all the features you need for secure, scalable authentication out of the box.
Universal Compatibility
Works seamlessly across browsers, Node.js, React Native, and SSR environments. One codebase, every platform.
Automatic Token Management
Smart token refresh with request queuing prevents race conditions. Never worry about expired tokens again.
Framework Agnostic
Integrates perfectly with Next.js, React, Vue, Express, and any JavaScript framework. No vendor lock-in.
Multiple Storage Options
Choose from localStorage, cookies, memory, or custom adapters. Optimal storage selection based on environment.
Production Ready
Built-in caching, monitoring, retry logic, circuit breakers, and comprehensive error handling for production workloads.
TypeScript First
Complete type safety with intelligent autocomplete. Zero dependencies in the core library for minimal bundle size.
Experience the Flow
See how authentication flows seamlessly across different environments and use cases.
Basic Setup
Get started with AuthFlow in just a few lines of code
Next.js Server Actions
Seamless server-side authentication with automatic cookie management
Cookie-Based Authentication
Secure authentication using httpOnly cookies
Enhanced Client (v2)
Production-ready features like caching, retries, and monitoring
Route Protection Middleware
Protect your routes with built-in middleware
import { createAuthFlow } from '@jmndao/auth-flow';
const auth = createAuthFlow({
baseURL: 'https://api.yourapp.com',
endpoints: {
login: '/auth/login',
refresh: '/auth/refresh'
},
tokens: {
access: 'accessToken',
refresh: 'refreshToken'
}
});
// Login user
const user = await auth.login({
email: 'user@example.com',
password: 'password'
});
// Make authenticated requests
const profile = await auth.get('/api/profile');
const settings = await auth.post('/api/settings', data);
Built for Scale & Speed
AuthFlow delivers exceptional performance while keeping your development experience smooth and productive.
Ready to Experience
Effortless Auth Flow?
Join thousands of developers building secure, scalable applications with seamless authentication flows. Get started in minutes, not hours.