auth-plug-n-play
v0.1.3
Published
Reusable authentication components for Next.js and NextAuth v5
Downloads
6
Maintainers
Readme
A collection of pre-built, styled authentication components for use with Next.js and NextAuth v5.
Install
npm install @yourusername/next-auth-componentsKey Features
🔐 Authentication:
- Next-auth v5 (Auth.js)
- Credentials Provider
- OAuth Provider (Google & GitHub)
🔒 Security:
- Forgot password functionality
- Email verification
- Two-factor verification (2FA)
👥 User Management:
- User roles (Admin & User)
- Flexible login (Redirect or Modal)
- Register, Forgot Password, Verification components
🧩 Components & Utilities:
- Reusable Login and Logout buttons
- Role Gate for access control
- Middleware, session, and callback exploration
- Hooks: useCurrentUser, useRole
- Utilities: currentUser, currentRole
🌐 Examples & Demonstrations:
- Server and client-side rendering examples
- Render content based on roles
- Protect API routes and server actions
⚙️ Settings Page Functionality:
- Change email with new verification
- Change password with old password confirmation
- Enable/disable 2FA
- Change user role (for development)
Usage
import { LoginForm, RegisterForm } from "auth-plug-n-play";
export default function AuthPage() {
return (
<div>
<LoginForm />
<RegisterForm />
</div>
);
}