Skip to content

Commit 1eff864

Browse files
authored
✨ feat: remove NextAuth (lobehub#11732)
1 parent 0fcf8b0 commit 1eff864

File tree

145 files changed

+2989
-3563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+2989
-3563
lines changed

.env.desktop

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ KEY_VAULTS_SECRET=oLXWIiR/AKF+rWaqy9lHkrYgzpATbW3CtJp3UfkVgpE=
55
DATABASE_URL=postgresql://postgres@localhost:5432/postgres
66
SEARCH_PROVIDERS=search1api
77
NEXT_PUBLIC_IS_DESKTOP_APP=1
8-
NEXT_PUBLIC_ENABLE_NEXT_AUTH=0

.env.example

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
# Example: Allow specific internal servers while keeping SSRF protection
2525
# SSRF_ALLOW_IP_ADDRESS_LIST=192.168.1.100,10.0.0.50
2626

27-
########################################
28-
############ Redis Settings ############
29-
########################################
27+
# #######################################
28+
# ########### Redis Settings ############
29+
# #######################################
3030

3131
# Connection string for self-hosted Redis (Docker/K8s/managed). Use container hostname when running via docker-compose.
3232
# REDIS_URL=redis://localhost:6379
@@ -44,9 +44,9 @@
4444
# Namespace prefix for cache/queue keys.
4545
# REDIS_PREFIX=lobechat
4646

47-
########################################
48-
########## AI Provider Service #########
49-
########################################
47+
# #######################################
48+
# ######### AI Provider Service #########
49+
# #######################################
5050

5151
# ## OpenAI ###
5252

@@ -277,32 +277,24 @@ OPENAI_API_KEY=sk-xxxxxxxxx
277277
# ########### Auth Service ##############
278278
# #######################################
279279

280-
# NextAuth related configurations
281-
# NEXT_PUBLIC_ENABLE_NEXT_AUTH=1
282-
# NEXT_AUTH_SECRET=
283-
284-
# Auth0 configurations
285-
# AUTH_AUTH0_ID=
286-
# AUTH_AUTH0_SECRET=
287-
# AUTH_AUTH0_ISSUER=https://your-domain.auth0.com
288-
289-
# Better-Auth related configurations
290-
# NEXT_PUBLIC_ENABLE_BETTER_AUTH=1
291-
292280
# Auth Secret (use `openssl rand -base64 32` to generate)
293-
# Shared between Better-Auth and Next-Auth
294281
# AUTH_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
295282

296283
# Require email verification before allowing users to sign in (default: false)
297284
# Set to '1' to force users to verify their email before signing in
298-
# NEXT_PUBLIC_AUTH_EMAIL_VERIFICATION=0
285+
# AUTH_EMAIL_VERIFICATION=0
299286

300287
# SSO Providers Configuration (for Better-Auth)
301288
# Comma-separated list of enabled OAuth providers
302289
# Supported providers: auth0, authelia, authentik, casdoor, cloudflare-zero-trust, cognito, generic-oidc, github, google, keycloak, logto, microsoft, microsoft-entra-id, okta, zitadel
303290
# Example: AUTH_SSO_PROVIDERS=google,github,auth0,microsoft-entra-id
304291
# AUTH_SSO_PROVIDERS=
305292

293+
# Email whitelist for registration (comma-separated)
294+
# Supports full email (user@example.com) or domain (example.com)
295+
# Leave empty to allow all emails
296+
# AUTH_ALLOWED_EMAILS=example.com,admin@other.com
297+
306298
# Google OAuth Configuration (for Better-Auth)
307299
# Get credentials from: https://console.cloud.google.com/apis/credentials
308300
# Authorized redirect URIs:
@@ -366,6 +358,10 @@ OPENAI_API_KEY=sk-xxxxxxxxx
366358
# SMTP authentication password (use app-specific password for Gmail)
367359
# SMTP_PASS=your-password-or-app-specific-password
368360

361+
# Sender email address (optional, defaults to SMTP_USER)
362+
# Required for AWS SES where SMTP_USER is not a valid email address
363+
# SMTP_FROM=noreply@example.com
364+
369365
# #######################################
370366
# ######### Server Database #############
371367
# #######################################

.env.example.development

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ REDIS_PREFIX=lobechat
3737
REDIS_TLS=0
3838

3939
# Authentication Configuration
40-
# Enable Better Auth authentication
41-
NEXT_PUBLIC_ENABLE_BETTER_AUTH=1
42-
43-
# Better Auth secret for JWT signing (generate with: openssl rand -base64 32)
40+
# Auth secret for JWT signing (generate with: openssl rand -base64 32)
4441
AUTH_SECRET=${UNSAFE_SECRET}
4542

4643
# SSO providers configuration - using Casdoor for development

.github/workflows/e2e.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ env:
1414
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
1515
DATABASE_DRIVER: node
1616
KEY_VAULTS_SECRET: LA7n9k3JdEcbSgml2sxfw+4TV1AzaaFU5+R176aQz4s=
17-
BETTER_AUTH_SECRET: e2e-test-secret-key-for-better-auth-32chars!
18-
NEXT_PUBLIC_ENABLE_BETTER_AUTH: '1'
19-
NEXT_PUBLIC_AUTH_EMAIL_VERIFICATION: '0'
17+
AUTH_SECRET: e2e-test-secret-key-for-better-auth-32chars!
18+
AUTH_EMAIL_VERIFICATION: "0"
2019
# Mock S3 env vars to prevent initialization errors
2120
S3_ACCESS_KEY_ID: e2e-mock-access-key
2221
S3_SECRET_ACCESS_KEY: e2e-mock-secret-key
@@ -34,8 +33,8 @@ jobs:
3433
- id: skip_check
3534
uses: fkirc/skip-duplicate-actions@v5
3635
with:
37-
concurrent_skipping: 'same_content_newer'
38-
skip_after_successful_duplicate: 'true'
36+
concurrent_skipping: "same_content_newer"
37+
skip_after_successful_duplicate: "true"
3938
do_not_skip: '["workflow_dispatch", "schedule"]'
4039

4140
e2e:
@@ -75,7 +74,7 @@ jobs:
7574
- name: Build application
7675
run: bun run build
7776
env:
78-
SKIP_LINT: '1'
77+
SKIP_LINT: "1"
7978

8079
- name: Run E2E tests
8180
run: bun run e2e
@@ -84,8 +83,8 @@ jobs:
8483
if: failure()
8584
uses: actions/upload-artifact@v6
8685
with:
87-
name: e2e-artifacts
88-
path: |
89-
e2e/reports
90-
e2e/screenshots
91-
if-no-files-found: ignore
86+
name: e2e-artifacts
87+
path: |
88+
e2e/reports
89+
e2e/screenshots
90+
if-no-files-found: ignore

Dockerfile

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ FROM base AS builder
3232

3333
ARG USE_CN_MIRROR
3434
ARG NEXT_PUBLIC_BASE_PATH
35-
ARG NEXT_PUBLIC_ENABLE_NEXT_AUTH
3635
ARG NEXT_PUBLIC_SENTRY_DSN
3736
ARG NEXT_PUBLIC_ANALYTICS_POSTHOG
3837
ARG NEXT_PUBLIC_POSTHOG_HOST
@@ -45,8 +44,7 @@ ARG FEATURE_FLAGS
4544
ENV NEXT_PUBLIC_BASE_PATH="${NEXT_PUBLIC_BASE_PATH}" \
4645
FEATURE_FLAGS="${FEATURE_FLAGS}"
4746

48-
ENV NEXT_PUBLIC_ENABLE_NEXT_AUTH="${NEXT_PUBLIC_ENABLE_NEXT_AUTH:-0}" \
49-
APP_URL="http://app.com" \
47+
ENV APP_URL="http://app.com" \
5048
DATABASE_DRIVER="node" \
5149
DATABASE_URL="postgres://postgres:password@localhost:5432/postgres" \
5250
KEY_VAULTS_SECRET="use-for-build"
@@ -183,7 +181,33 @@ ENV KEY_VAULTS_SECRET="" \
183181

184182
# Better Auth
185183
ENV AUTH_SECRET="" \
186-
AUTH_SSO_PROVIDERS=""
184+
AUTH_SSO_PROVIDERS="" \
185+
AUTH_ALLOWED_EMAILS="" \
186+
# Google
187+
AUTH_GOOGLE_ID="" \
188+
AUTH_GOOGLE_SECRET="" \
189+
# GitHub
190+
AUTH_GITHUB_ID="" \
191+
AUTH_GITHUB_SECRET="" \
192+
# Microsoft
193+
AUTH_MICROSOFT_ID="" \
194+
AUTH_MICROSOFT_SECRET=""
195+
196+
# Redis
197+
ENV REDIS_URL="" \
198+
REDIS_PREFIX="" \
199+
REDIS_TLS=""
200+
201+
# Email
202+
ENV EMAIL_SERVICE_PROVIDER="" \
203+
SMTP_HOST="" \
204+
SMTP_PORT="" \
205+
SMTP_SECURE="" \
206+
SMTP_USER="" \
207+
SMTP_PASS="" \
208+
SMTP_FROM="" \
209+
RESEND_API_KEY="" \
210+
RESEND_FROM=""
187211

188212
# S3
189213
ENV NEXT_PUBLIC_S3_DOMAIN="" \

docker-compose/local/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ services:
128128
condition: service_healthy
129129

130130
environment:
131-
- 'NEXT_AUTH_SSO_PROVIDERS=casdoor'
131+
- 'AUTH_SSO_PROVIDERS=casdoor'
132132
- 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
133-
- 'NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
133+
- 'AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
134134
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
135135
- 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
136136
- 'S3_ENABLE_PATH_STYLE=1'

docker-compose/local/grafana/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ services:
173173
condition: service_started
174174

175175
environment:
176-
- 'NEXT_AUTH_SSO_PROVIDERS=casdoor'
176+
- 'AUTH_SSO_PROVIDERS=casdoor'
177177
- 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
178-
- 'NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
178+
- 'AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
179179
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
180180
- 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
181181
- 'S3_ENABLE_PATH_STYLE=1'

docker-compose/local/logto/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ services:
9696

9797
environment:
9898
- 'APP_URL=http://localhost:3210'
99-
- 'NEXT_AUTH_SSO_PROVIDERS=logto'
99+
- 'AUTH_SSO_PROVIDERS=logto'
100100
- 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
101-
- 'NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
101+
- 'AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
102102
- 'NEXTAUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
103103
- 'AUTH_LOGTO_ISSUER=http://localhost:${LOGTO_PORT}/oidc'
104104
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'

docker-compose/local/zitadel/.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ DATABASE_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/lobechat
1010

1111
# NEXT_AUTH related environment variables
1212
NEXTAUTH_URL=http://localhost:3210/api/auth
13-
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
14-
NEXT_AUTH_SSO_PROVIDERS=zitadel
13+
AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
14+
AUTH_SSO_PROVIDERS=zitadel
1515
# ZiTADEL provider configuration
1616
# Please refer to:https://lobehub.com/zh/docs/self-hosting/advanced/auth/next-auth/zitadel
1717
AUTH_ZITADEL_ID=285945938244075523

docker-compose/local/zitadel/.env.zh-CN.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ DATABASE_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/lobechat
99

1010
# NEXT_AUTH 相关
1111
NEXTAUTH_URL=http://localhost:3210/api/auth
12-
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
13-
NEXT_AUTH_SSO_PROVIDERS=zitadel
12+
AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
13+
AUTH_SSO_PROVIDERS=zitadel
1414
# ZiTADEL 鉴权服务提供商部分
1515
# 请参考:https://lobehub.com/zh/docs/self-hosting/advanced/auth/next-auth/zitadel
1616
AUTH_ZITADEL_ID=285945938244075523

0 commit comments

Comments
 (0)