Back to Lobehub

Configuring Email/Password Authentication for LobeHub

docs/self-hosting/auth/providers/password.mdx

2.1.563.1 KB
Original Source

Configuring Email/Password Authentication

LobeHub supports traditional email and password authentication out of the box. This guide covers the available configuration options.

Default Behavior

By default, email/password authentication is enabled. Users can register with their email address and set a password.

Configuration Options

Disable Email/Password Authentication (SSO-Only Mode)

If you want to force users to authenticate via SSO providers only, set the following environment variable:

Environment VariableTypeDescription
AUTH_DISABLE_EMAIL_PASSWORDOptionalSet to 1 to disable email/password login

When enabled:

  • The email input field is hidden on the login page
  • Only SSO provider buttons are displayed
  • The signup page redirects to the login page
  • Users must authenticate through configured SSO providers

<Callout type={'warning'}> Before enabling SSO-only mode, ensure you have configured at least one SSO provider via AUTH_SSO_PROVIDERS. Otherwise, users will have no way to log in. </Callout>

Enable Email Verification

To require users to verify their email address before signing in:

Environment VariableTypeDescription
AUTH_EMAIL_VERIFICATIONOptionalSet to 1 to require email verification

This requires configuring an email service (SMTP). See Email Service Configuration for details.

To allow passwordless login via email magic links:

Environment VariableTypeDescription
AUTH_ENABLE_MAGIC_LINKOptionalSet to 1 to enable magic link login

This also requires configuring an email service (SMTP).

Change Password

Users can change their password in two ways:

  1. Profile Settings: Go to Settings > Profile to change password
  2. Forgot Password: On the login page, enter email, proceed to the password step, then click "Forgot Password" below the password input

<Callout type={'info'}> Both methods require email service (SMTP) to be configured for sending password reset emails. </Callout>

Example Configurations

SSO-Only (Disable Email/Password)

bash
AUTH_DISABLE_EMAIL_PASSWORD=1
AUTH_SSO_PROVIDERS=google,github

Email/Password with Verification

bash
AUTH_EMAIL_VERIFICATION=1
SMTP_HOST=smtp.example.com
SMTP_PORT=587
[email protected]
SMTP_PASS=your-password
bash
AUTH_ENABLE_MAGIC_LINK=1
SMTP_HOST=smtp.example.com
SMTP_PORT=587
[email protected]
SMTP_PASS=your-password

<Callout type={'tip'}> Go to Environment Variables for detailed information on all authentication variables. </Callout>