Stack Auth Integration
Stack Auth is an open-source authentication and authorization platform designed for modern web applications, providing secure user management with a focus on developer experience.
Environment Variables
Required Server Variables
STACK_PROJECT_ID=your_project_id_here # Your Stack project ID
STACK_PUBLISHABLE_CLIENT_KEY=pk_... # Your Stack publishable client key
STACK_SECRET_SERVER_KEY=sk_... # Your Stack secret server key
Setup Instructions
-
Set Up Stack Auth: You can either:
- Use Stack Auth Cloud (hosted service)
- Self-host Stack Auth on your own infrastructure
-
Create a Stack Project:
- Go to your Stack dashboard
- Create a new project
- Configure your authentication settings
-
Get Your API Keys:
- In your Stack project dashboard, go to "Settings" → "API Keys"
- Copy your Project ID, Publishable Client Key, and Secret Server Key
-
Add Environment Variables:
STACK_PROJECT_ID=your_project_id_here STACK_PUBLISHABLE_CLIENT_KEY=pk_your_client_key_here STACK_SECRET_SERVER_KEY=sk_your_server_key_here
Features Enabled
When these environment variables are configured, the following features become available:
- ✅ User registration and login
- ✅ Social OAuth providers (Google, GitHub, Discord, etc.)
- ✅ Email and password authentication
- ✅ Magic link authentication
- ✅ Password reset functionality
- ✅ Email verification
- ✅ Session management
- ✅ User profile management
- ✅ Team and organization support
- ✅ Role-based access control (RBAC)
Configuration Options
Advanced Configuration
You can customize Stack Auth behavior:
# Custom API endpoints (if self-hosting)
STACK_API_URL=https://your-stack-instance.com
# Email configuration
STACK_EMAIL_FROM=noreply@yourdomain.com
# Session configuration
STACK_SESSION_MAX_AGE=86400 # 24 hours in seconds
Supported OAuth Providers
Stack Auth supports major OAuth providers:
- GitHub
- Discord
- Microsoft
- And more...
Configure these in your Stack dashboard for automatic integration.
Testing
Stack Auth provides comprehensive testing features:
- Test authentication flows in development
- Use test OAuth applications
- Verify email delivery
- Test team management features
- Monitor authentication events
Production Deployment
Before going live:
- Ensure secure key management
- Configure production domains
- Set up proper email delivery
- Configure OAuth applications for production
- Set up proper monitoring and logging
- Review security configurations