Authentication
Authentication
Section titled âAuthenticationâStelo CMS uses NextAuth.js for secure, flexible authentication with support for multiple providers.
Supported Providers
Section titled âSupported ProvidersâEmail/Password
Section titled âEmail/Passwordâ- Secure credential authentication
- Password hashing with bcrypt
- Email verification workflow
- Password reset functionality
OAuth Providers
Section titled âOAuth Providersâ- Google OAuth integration
- GitHub authentication (optional)
- Custom OAuth providers
Session Management
Section titled âSession Managementâ- JWT-based sessions
- Secure session storage
- Automatic session refresh
- Cross-device synchronization
Configuration
Section titled âConfigurationâexport const authOptions: NextAuthOptions = { providers: [ CredentialsProvider({ credentials: { email: { type: "email" }, password: { type: "password" } }, authorize: async (credentials) => { // Authentication logic } }), GoogleProvider({ clientId: process.env.GOOGLE_CLIENT_ID, clientSecret: process.env.GOOGLE_CLIENT_SECRET }) ], callbacks: { session: ({ session, token }) => ({ ...session, user: { ...session.user, id: token.sub, role: token.role } }), jwt: ({ token, user }) => { if (user) { token.role = user.role; } return token; } }};Security Features
Section titled âSecurity Featuresâ- CSRF protection
- Secure session cookies
- Rate limiting
- Account verification
This section will be expanded with detailed implementation examples.