Hopp til hovedinnhold

Hansen Auth

Modern authentication framework for TypeScript

Enterprise-grade security meets developer-friendly simplicity.Inspired by Better Auth • Built by Cato Hansen Agency

5 min
Setup Time
100%
TypeScript
Extensible

Everything You Need

Comprehensive authentication out of the box, extendable with plugins

Email & Password

Secure email and password authentication with bcrypt hashing

Social Sign-on

OAuth support for Google, GitHub, Discord, Twitter, and more

Two-Factor Auth

TOTP-based 2FA support for enhanced security

Session Management

Flexible session management with remember-me support

Account Security

Account locking, failed login tracking, and audit logging

Advanced RBAC

Hierarchical roles, granular permissions, and multi-tenant support

Framework Agnostic

Works with React, Vue, Svelte, Next.js, and any framework

Plugin System

Extensible plugin ecosystem for custom functionality

TypeScript First

Full type safety with automatically generated types

5-Minute Setup

Get started with Hansen Auth in minutes, not hours

Installation
npm install @catohansen/hansen-auth
Configuration
import { createAuth } from '@catohansen/hansen-auth'

export const auth = createAuth({
  emailAndPassword: {
    enabled: true,
  },
  socialAuth: {
    providers: ['google', 'github'],
  },
  session: {
    maxAge: 30, // 30 days
    defaultAge: 7, // 7 days
  },
})
Usage
// Sign in
const result = await auth.signIn({
  email: 'user@example.com',
  password: 'secure-password',
  rememberMe: true,
})

// Use pre-built components
import { SignInForm } from '@catohansen/hansen-auth/react'

<SignInForm
  socialProviders={['google', 'github']}
  onSuccess={(user) => console.log('Signed in:', user)}
/>

Enterprise-Grade Security

Built with security best practices and compliance in mind

Encryption

End-to-end encryption for all data transmission

Key Management

Secure key generation and rotation

Access Control

Multi-factor authentication and RBAC

SOC 2 Compliance
GDPR Ready
ISO 27001
2FA Support
Audit Logging
Rate Limiting
CSRF Protection
XSS Prevention

Why Hansen Auth?

Best of Better Auth, enhanced with enterprise features

Our Advantages

  • Advanced RBAC with hierarchical roles
  • Policy Engine integration (Hansen Security)
  • Complete audit logging
  • Multi-tenant support
  • Enterprise compliance (SOC2, ISO27001, GDPR)
  • Modular architecture (extract & sell separately)
  • Pre-built components for React, Vue, Svelte
  • Plugin system for extensibility

Better Auth Features

  • Framework-agnostic core
  • Simple API (signIn, signUp, signOut)
  • Pre-built UI components
  • TypeScript-first
  • Social sign-on (OAuth)
  • 2FA support
  • Session management
  • Plugin ecosystem

Ready to Get Started?

Join developers building secure, scalable authentication with Hansen Auth