Skip to content

Authentication

Stelo CMS uses NextAuth.js for secure, flexible authentication with support for multiple providers.

  • Secure credential authentication
  • Password hashing with bcrypt
  • Email verification workflow
  • Password reset functionality
  • Google OAuth integration
  • GitHub authentication (optional)
  • Custom OAuth providers
  • JWT-based sessions
  • Secure session storage
  • Automatic session refresh
  • Cross-device synchronization
auth.config.ts
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;
}
}
};
  • CSRF protection
  • Secure session cookies
  • Rate limiting
  • Account verification

This section will be expanded with detailed implementation examples.