Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
28ab79b
build(deps): bump lucide-react from 0.513.0 to 0.525.0
dependabot[bot] Jun 30, 2025
495d537
build(deps): bump fumadocs-mdx from 11.6.9 to 11.6.10
dependabot[bot] Jun 30, 2025
17f5858
build(deps-dev): bump tailwindcss from 4.1.10 to 4.1.11
dependabot[bot] Jun 30, 2025
f64e537
build(deps): bump next from 15.3.3 to 15.3.4
dependabot[bot] Jun 30, 2025
a314f3a
Merge pull request #160 from deploystackio/dependabot/npm_and_yarn/fu…
Lasim Jul 2, 2025
c9e8a53
Merge pull request #162 from deploystackio/dependabot/npm_and_yarn/ne…
Lasim Jul 2, 2025
a00df3b
Merge pull request #158 from deploystackio/dependabot/npm_and_yarn/lu…
Lasim Jul 2, 2025
2e1fc95
build(deps): bump fumadocs-core from 15.5.4 to 15.6.0
dependabot[bot] Jul 2, 2025
5b3043d
Merge pull request #161 from deploystackio/dependabot/npm_and_yarn/ta…
Lasim Jul 2, 2025
0eeab70
Merge pull request #159 from deploystackio/dependabot/npm_and_yarn/fu…
Lasim Jul 2, 2025
b3df754
Enhance email logging, add OAuth implementation guide, improve plugin…
Jul 6, 2025
ee6fce8
Enhance team management documentation: clarify multi-user support, me…
Jul 6, 2025
eea7798
build(deps): bump next from 15.3.4 to 15.3.5
dependabot[bot] Jul 7, 2025
c01ae9b
build(deps): bump fumadocs-ui from 15.5.4 to 15.6.3
dependabot[bot] Jul 14, 2025
d8b811a
build(deps-dev): bump @types/node from 24.0.4 to 24.0.13
dependabot[bot] Jul 14, 2025
712b8a6
feat: Add comprehensive documentation for UI Design System, GitHub In…
Jul 15, 2025
4831a2e
Merge pull request #170 from deploystackio/feat/new-docs
Lasim Jul 15, 2025
0f94422
Merge pull request #169 from deploystackio/dependabot/npm_and_yarn/ty…
Lasim Jul 15, 2025
5fc63ca
Merge pull request #167 from deploystackio/dependabot/npm_and_yarn/fu…
Lasim Jul 15, 2025
fff2387
Merge pull request #163 from deploystackio/dependabot/npm_and_yarn/ne…
Lasim Jul 15, 2025
e1fb3c1
build(deps-dev): bump @tailwindcss/postcss from 4.1.10 to 4.1.11
dependabot[bot] Jul 15, 2025
40fd96a
build(deps): bump fumadocs-mdx from 11.6.10 to 11.6.11
dependabot[bot] Jul 15, 2025
fbbba67
Merge pull request #168 from deploystackio/dependabot/npm_and_yarn/fu…
Lasim Jul 15, 2025
5598074
Merge pull request #166 from deploystackio/dependabot/npm_and_yarn/ta…
Lasim Jul 15, 2025
4736ebd
docs: add comprehensive guide for custom UI components in DeployStack
Jul 19, 2025
fe1fcd5
refactor: migrate from zod-to-json-schema to zod-openapi for schema g…
Jul 19, 2025
0957fa9
docs: remove comparison reference to Cloudflare D1 Development Guide …
Jul 19, 2025
479c100
Merge pull request #171 from deploystackio/feat/ui
Lasim Jul 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 232 additions & 0 deletions docs/deploystack/auth.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
---
title: Authentication Methods
description: Available authentication methods in DeployStack, including email registration and GitHub OAuth, with configuration instructions for administrators.
---

# Authentication Methods

DeployStack supports multiple authentication methods to provide flexibility for different user preferences and organizational requirements. This document outlines the available authentication options and how to configure them.

## Available Authentication Methods

### Email Registration & Login

Email-based authentication is the primary authentication method in DeployStack. Users can register with their email address and password, and subsequently log in using these credentials.

**Features:**
- Secure password hashing using Argon2
- Email verification (when email sending is enabled)
- Password reset functionality
- Profile management

**User Experience:**
1. Users register with email, password, and optional personal information
2. Email verification may be required (depending on configuration)
3. Users can log in using email or username
4. Password reset available via email (when email sending is enabled)

### GitHub OAuth

GitHub OAuth provides a convenient way for users to authenticate using their existing GitHub accounts. This method is particularly useful for development teams and organizations already using GitHub.

**Features:**
- Single sign-on with GitHub
- Automatic email verification (GitHub emails are considered verified)
- Profile information imported from GitHub
- Secure OAuth 2.0 flow

**User Experience:**
1. Users click "Login with GitHub" button
2. Redirected to GitHub for authorization
3. Upon approval, automatically logged into DeployStack
4. Profile information (name, email) imported from GitHub

## Authentication Configuration

### Global Authentication Settings

Administrators can control authentication behavior through global settings:

| Setting | Description | Default |
|---------|-------------|---------|
| **Enable Login** | Master switch for all authentication methods | `true` |
| **Enable Email Registration** | Allow new users to register via email | `true` |
| **GitHub OAuth Enabled** | Enable GitHub OAuth authentication | `false` |

### Email Authentication Configuration

Email authentication is always available but requires SMTP configuration for full functionality:

**Required for Full Functionality:**
- SMTP server configuration (for email verification and password reset)
- Email sending enabled in global settings

**Configuration Steps:**
1. Navigate to **Global Settings** → **SMTP Mail Settings**
2. Configure SMTP server details:
- Host (e.g., `smtp.gmail.com`)
- Port (e.g., `587`)
- Username and Password
- Security settings
3. Enable email sending in **Global Settings** → **Global Configuration**

### GitHub OAuth Configuration

GitHub OAuth requires setup both in GitHub and DeployStack:

**GitHub Setup:**
1. Go to GitHub → Settings → Developer settings → OAuth Apps
2. Create a new OAuth App with:
- **Application name**: Your DeployStack instance name
- **Homepage URL**: Your DeployStack frontend URL
- **Authorization callback URL**: `https://your-domain.com/api/auth/github/callback`
3. Note the **Client ID** and **Client Secret**

**DeployStack Configuration:**
1. Navigate to **Global Settings** → **GitHub OAuth Configuration**
2. Configure the following settings:
- **Client ID**: From your GitHub OAuth App
- **Client Secret**: From your GitHub OAuth App (encrypted)
- **Enabled**: Set to `true` to activate GitHub OAuth
- **Callback URL**: Must match the URL configured in GitHub
- **Scope**: OAuth permissions (default: `user:email`)

**Configuration Example:**
```
Client ID: abc123def456
Client Secret: [encrypted]
Enabled: true
Callback URL: https://your-deploystack.com/api/auth/github/callback
Scope: user:email
```

## User Roles and First User

### First User (Global Administrator)

The first user registered in DeployStack automatically becomes the **Global Administrator** with full system access. This ensures there's always at least one administrator who can manage the system.

**Important Notes:**
- The first user **must** be created via email registration
- GitHub OAuth cannot be used to create the first user
- This prevents accidental creation of admin accounts via OAuth

### Subsequent Users

All users registered after the first user receive the **Global User** role by default, regardless of authentication method used.

**Role Assignment:**
- **Email Registration**: `global_user` role
- **GitHub OAuth**: `global_user` role
- **Role Changes**: Only global administrators can modify user roles

## Security Considerations

### Email Authentication Security

- Passwords are hashed using Argon2 with secure parameters
- Email verification prevents unauthorized account creation
- Password reset tokens are time-limited and single-use
- Session management handled by Lucia v3

### GitHub OAuth Security

- OAuth 2.0 standard with state parameter for CSRF protection
- GitHub emails are considered verified
- Secure token exchange and validation
- No GitHub credentials stored in DeployStack

### Account Linking

When a user with an existing email account uses GitHub OAuth with the same email address:
- The GitHub account is automatically linked to the existing account
- User can subsequently use either authentication method
- No duplicate accounts are created

## Troubleshooting

### Email Authentication Issues

**Email verification not working:**
- Check SMTP configuration in Global Settings
- Verify email sending is enabled
- Check server logs for email delivery errors

**Password reset not working:**
- Ensure SMTP is configured and email sending is enabled
- Verify the reset link hasn't expired (tokens are time-limited)

### GitHub OAuth Issues

**"GitHub OAuth is not enabled" error:**
- Check that GitHub OAuth is enabled in Global Settings
- Verify Client ID and Client Secret are configured
- Ensure callback URL matches GitHub OAuth App configuration

**"GitHub email not available" error:**
- User's GitHub email must be public and verified
- Check GitHub account email settings
- Ensure OAuth scope includes `user:email`

**First user creation blocked:**
- This is expected behavior - first user must use email registration
- Use email registration to create the initial administrator account

### General Authentication Issues

**Login disabled:**
- Check that "Enable Login" is set to `true` in Global Settings
- Verify database is properly configured and accessible

**Registration disabled:**
- Check that "Enable Email Registration" is set to `true` for email signup
- Verify GitHub OAuth is enabled and configured for GitHub login

## API Endpoints

For developers and integrations, DeployStack provides REST API endpoints for authentication:

### Email Authentication
- `POST /api/auth/email/register` - User registration
- `POST /api/auth/email/login` - User login
- `POST /api/auth/email/forgot-password` - Password reset request
- `POST /api/auth/email/reset-password` - Password reset confirmation

### GitHub OAuth
- `GET /api/auth/github/login` - Initiate GitHub OAuth flow
- `GET /api/auth/github/callback` - OAuth callback handler
- `GET /api/auth/github/status` - Check if GitHub OAuth is enabled

### General Authentication
- `POST /api/auth/logout` - User logout
- `GET /api/users/me` - Get current user profile
- `PUT /api/auth/profile/update` - Update user profile

## Best Practices

### For Administrators

1. **Always configure the first user via email** to ensure proper admin access
2. **Set up SMTP early** to enable email verification and password reset
3. **Use strong OAuth secrets** and keep them secure
4. **Regularly review user accounts** and roles
5. **Monitor authentication logs** for security issues

### For Users

1. **Use strong passwords** for email authentication
2. **Verify your email address** when using email registration
3. **Keep GitHub account secure** when using OAuth
4. **Use the same email address** across authentication methods for account linking

### For Organizations

1. **Choose authentication methods** that align with your security policies
2. **Consider GitHub OAuth** for development teams already using GitHub
3. **Implement proper access controls** through user roles
4. **Document authentication procedures** for your team
5. **Plan for account recovery** scenarios

---

For technical implementation details, see the [Backend Authentication Documentation](/deploystack/development/backend/api) and [Global Settings Management](/deploystack/global-settings).
Loading