🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
♻️ Refactor(V2): Remove deprecate envs to reserve Namespace for better-auth (#9954)
Rylan Cai78df7a7e868a
diff --git a/docs/self-hosting/advanced/auth.mdx b/docs/self-hosting/advanced/auth.mdxindex 1012c9ac569..7738e46dd90 100644--- a/docs/self-hosting/advanced/auth.mdx+++ b/docs/self-hosting/advanced/auth.mdx@@ -26,12 +26,13 @@ By setting the environment variables `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CLBefore using NextAuth, please set the following variables in LobeChat's environment variables:-| Environment Variable | Type | Description |-| ------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |-| `NEXT_PUBLIC_ENABLE_NEXT_AUTH` | Required | This is used to enable the NextAuth service. Set it to `1` to enable it; changing this setting requires recompiling the application. Users deploying with the `lobehub/lobe-chat-database` image have this configuration added by default. |-| `NEXT_AUTH_SECRET` | Required | The key used to encrypt Auth.js session tokens. You can use the following command: `openssl rand -base64 32`, or visit `https://generate-secret.vercel.app/32` to generate the key. |-| `NEXTAUTH_URL` | Required | This URL specifies the callback address for Auth.js when performing OAuth verification. Set this only if the default generated redirect address is incorrect. `https://example.com/api/auth` |-| `NEXT_AUTH_SSO_PROVIDERS` | Optional | This environment variable is used to enable multiple identity verification sources simultaneously, separated by commas, for example, `auth0,microsoft-entra-id,authentik`. |+| Environment Variable | Type | Description |+| -------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| `NEXT_PUBLIC_ENABLE_NEXT_AUTH` | Required | This is used to enable the NextAuth service. Set it to `1` to enable it; changing this setting requires recompiling the application. Users deploying with the `lobehub/lobe-chat-database` image have this configuration added by default. |+| `AUTH_SECRET` | Required | The key used to encrypt Auth.js session tokens. You can use the following command: `openssl rand -base64 32`, or visit `https://generate-secret.vercel.app/32` to generate the key. |+| `AUTH_URL` | Required | This URL specifies the callback address for Auth.js when performing OAuth verification. Set this only if the default generated redirect address is incorrect. `https://example.com/api/auth` |+| `NEXT_AUTH_SSO_PROVIDERS` | Optional | This environment variable is used to enable multiple identity verification sources simultaneously, separated by commas, for example, `auth0,microsoft-entra-id,authentik`. |+| `NEXT_AUTH_SSO_SESSION_STRATEGY` | Optional | The session strategy for Auth.js. Options are `jwt` or `database`. Default is `jwt`. |Currently supported identity verification services include:@@ -67,21 +68,31 @@ To simultaneously enable multiple identity verification sources, please set theThe order corresponds to the display order of the SSO providers.-| SSO Provider | Value |-| --------------------- | ----------------------- |-| Auth0 | `auth0` |-| Authenlia | `authenlia` |-| Authentik | `authentik` |-| Casdoor | `casdoor` |-| Cloudflare Zero Trust | `cloudflare-zero-trust` |-| Github | `github` |-| Logto | `logto` |-| Microsoft Entra ID | `microsoft-entra-id` |-| ZITADEL | `zitadel` |-| Keycloak | `keycloak` |-| Google | `google` |-| Okta | `okta` |+| SSO Provider | Value | Additional Features |+| --------------------- | ----------------------- | ------------------- |+| Auth0 | `auth0` | |+| Authenlia | `authenlia` | |+| Authentik | `authentik` | |+| Casdoor | `casdoor` | `Webhook` |+| Cloudflare Zero Trust | `cloudflare-zero-trust` | |+| Github | `github` | |+| Logto | `logto` | `Webhook` |+| Microsoft Entra ID | `microsoft-entra-id` | |+| ZITADEL | `zitadel` | |+| Keycloak | `keycloak` | |+| Google | `google` | |+| Okta | `okta` | |++## Additional Features++### Webhook Support++Allow LobeChat to receive notifications when user information is updated in the identity provider. Supported providers include Casdoor and Logto. Please refer to the specific provider documentation for configuration details.++### Database Session++Allow the session store in database, see also the [Auth.js Session Documentation](https://authjs.dev/concepts/session-strategies#database-session).## Other SSO Providers-Please refer to the [NextAuth.js](https://next-auth.js.org/providers) documentation and feel free to submit a Pull Request.+Please refer to the [Auth.js](https://authjs.dev/getting-started/authentication/oauth) documentation and feel free to submit a Pull Request.diff --git a/docs/self-hosting/advanced/auth.zh-CN.mdx b/docs/self-hosting/advanced/auth.zh-CN.mdxindex f93ed5abc6e..aa041bfbb51 100644--- a/docs/self-hosting/advanced/auth.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth.zh-CN.mdx@@ -24,12 +24,13 @@ LobeChat 与 Clerk 做了深度集成,能够为用户提供一个更加安全在使用 NextAuth 之前,请先在 LobeChat 的环境变量中设置以下变量:-| 环境变量 | 类型 | 描述 |-| ------------------------------ | -- | ------------------------------------------------------------------------------------------------------------ |-| `NEXT_PUBLIC_ENABLE_NEXT_AUTH` | 必选 | 用于启用 NextAuth 服务,设置为 `1` 以启用,更改此项需要重新编译应用。使用 `lobehub/lobe-chat-database` 镜像部署的用户已经默认添加了该项配置。 |-| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令: `openssl rand -base64 32`,或者访问 `https://generate-secret.vercel.app/32` 生成秘钥。 |-| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |-| `NEXT_AUTH_SSO_PROVIDERS` | 可选 | 该环境变量用于同时启用多个身份验证源,以逗号 `,` 分割,例如 `auth0,microsoft-entra-id,authentik`。 |+| 环境变量 | 类型 | 描述 |+| -------------------------------- | -- | ------------------------------------------------------------------------------------------------------------ |+| `NEXT_PUBLIC_ENABLE_NEXT_AUTH` | 必选 | 用于启用 NextAuth 服务,设置为 `1` 以启用,更改此项需要重新编译应用。使用 `lobehub/lobe-chat-database` 镜像部署的用户已经默认添加了该项配置。 |+| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令: `openssl rand -base64 32`,或者访问 `https://generate-secret.vercel.app/32` 生成秘钥。 |+| `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |+| `NEXT_AUTH_SSO_PROVIDERS` | 可选 | 该环境变量用于同时启用多个身份验证源,以逗号 `,` 分割,例如 `auth0,microsoft-entra-id,authentik`。 |+| `NEXT_AUTH_SSO_SESSION_STRATEGY` | 可选 | Auth.js 的会话策略。选项为 `jwt` 或 `database`。默认值为 `jwt`。 |目前支持的身份验证服务有:@@ -63,19 +64,29 @@ LobeChat 与 Clerk 做了深度集成,能够为用户提供一个更加安全顺序为 SSO 提供商的显示顺序。-| SSO 提供商 | 值 |-| --------------------- | ----------------------- |-| Auth0 | `auth0` |-| Authenlia | `authenlia` |-| Authentik | `authentik` |-| Casdoor | `casdoor` |-| Cloudflare Zero Trust | `cloudflare-zero-trust` |-| Github | `github` |-| Logto | `logto` |-| Microsoft Entra ID | `microsoft-entra-id` |-| ZITADEL | `zitadel` |-| Keycloak | `keycloak` |-| Okta | `okta` |+| SSO 提供商 | 值 | 额外功能 |+| --------------------- | ----------------------- | --------- |+| Auth0 | `auth0` | |+| Authenlia | `authenlia` | |+| Authentik | `authentik` | |+| Casdoor | `casdoor` | `Webhook` |+| Cloudflare Zero Trust | `cloudflare-zero-trust` | |+| Github | `github` | |+| Logto | `logto` | `Webhook` |+| Microsoft Entra ID | `microsoft-entra-id` | |+| ZITADEL | `zitadel` | |+| Keycloak | `keycloak` | |+| Okta | `okta` | |++## 额外功能++### Webhook 支持++允许 LobeChat 在身份提供商中用户信息更新时接收通知。支持的提供商包括 Casdoor 和 Logto。请参考具体提供商文档进行配置。++### 数据库会话++允许会话存储在数据库中,详情请参阅 [Auth.js 会话文档](https://authjs.dev/concepts/session-strategies#database-session)。## 其他 SSO 提供商diff --git a/docs/self-hosting/advanced/auth/next-auth/auth0.mdx b/docs/self-hosting/advanced/auth/next-auth/auth0.mdxindex 687a96ee3b8..1ef1b2658c8 100644--- a/docs/self-hosting/advanced/auth/next-auth/auth0.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/auth0.mdx@@ -55,12 +55,12 @@ tags:| Environment Variable | Type | Description || ------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` |+ | `AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `auth0` for Auth0. || `AUTH_AUTH0_ID` | Required | Client ID of the Auth0 application || `AUTH_AUTH0_SECRET` | Required | Client Secret of the Auth0 application || `AUTH_AUTH0_ISSUER` | Required | Domain of the Auth0 application, `https://example.auth0.com` |- | `NEXTAUTH_URL` | Required | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |+ | `AUTH_URL` | Required | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |<Callout type={'tip'}>You can refer to the related variable details at [📘Environment Variables](/docs/self-hosting/environment-variable#auth0).diff --git a/docs/self-hosting/advanced/auth/next-auth/auth0.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/auth0.zh-CN.mdxindex 36296fa3175..725696b43b2 100644--- a/docs/self-hosting/advanced/auth/next-auth/auth0.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/auth0.zh-CN.mdx@@ -51,12 +51,12 @@ tags:| 环境变量 | 类型 | 描述 || ------------------------- | -- | ------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |+ | `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Auth0 请填写 `auth0`。 || `AUTH_AUTH0_ID` | 必选 | Auth0 应用程序的 Client ID || `AUTH_AUTH0_SECRET` | 必选 | Auth0 应用程序的 Client Secret || `AUTH_AUTH0_ISSUER` | 必选 | Auth0 应用程序的 Domain,`https://example.auth0.com` |- | `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |+ | `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |<Callout type={'tip'}>前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#auth-0) 可查阅相关变量详情。diff --git a/docs/self-hosting/advanced/auth/next-auth/authelia.mdx b/docs/self-hosting/advanced/auth/next-auth/authelia.mdxindex 3b78baf12ca..33bbcff1c82 100644--- a/docs/self-hosting/advanced/auth/next-auth/authelia.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/authelia.mdx@@ -54,12 +54,12 @@ tags:| Environment Variable | Type | Description || ------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` |+ | `AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the SSO provider for LoboChat. Use `authentik` for Authentik. || `AUTH_AUTHELIA_ID` | Required | The id just configured in Authelia, example value is lobe-chat || `AUTH_AUTHELIA_SECRET` | Required | The plaintext corresponding to the secret just configured in Authelia, example value is `insecure_secret` || `AUTH_AUTHELIA_ISSUER` | Required | Your Authelia URL, for example [https://sso.example.com](https://sso.example.com) |- | `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth verification. It only needs to be set when the default generated redirect address is incorrect. [https://chat.example.com/api/auth](https://chat.example.com/api/auth) |+ | `AUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth verification. It only needs to be set when the default generated redirect address is incorrect. [https://chat.example.com/api/auth](https://chat.example.com/api/auth) |<Callout type={'tip'}>Go to [📘 Environment Variables](/docs/self-hosting/environment-variable#Authelia) for details about the variables.diff --git a/docs/self-hosting/advanced/auth/next-auth/authelia.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/authelia.zh-CN.mdxindex 19e6dd89266..437439d973d 100644--- a/docs/self-hosting/advanced/auth/next-auth/authelia.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/authelia.zh-CN.mdx@@ -53,12 +53,12 @@ tags:| 环境变量 | 类型 | 描述 || ------------------------- | -- | ------------------------------------------------------------------------------------------------ |- | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |+ | `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Authelia 请填写 `authelia`。 || `AUTH_AUTHELIA_ID` | 必选 | 刚刚在 Authelia 配置的 `id`,示例值是 `lobe-chat` || `AUTH_AUTHELIA_SECRET` | 必选 | 刚刚在 Authelia 配置的 `secret` 对应的明文,示例值是 `insecure_secret` || `AUTH_AUTHELIA_ISSUER` | 必选 | 您的 Authelia 的网址,例如 `https://sso.example.com` |- | `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://chat.example.com/api/auth` |+ | `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://chat.example.com/api/auth` |<Callout type={'tip'}>前往 [📘 环境变量](/zh/docs/self-hosting/environment-variable#Authelia) 可查阅相关变量详情。diff --git a/docs/self-hosting/advanced/auth/next-auth/authentik.mdx b/docs/self-hosting/advanced/auth/next-auth/authentik.mdxindex a22215f4851..74e469c07ac 100644--- a/docs/self-hosting/advanced/auth/next-auth/authentik.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/authentik.mdx@@ -49,12 +49,12 @@ tags:| Environment Variable | Type | Description || ------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` |+ | `AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the SSO provider for LoboChat. Use `authentik` for Authentik. || `AUTH_AUTHENTIK_ID` | Required | The Client ID from the Authentik application provider details page || `AUTH_AUTHENTIK_SECRET` | Required | The Client Secret from the Authentik application provider details page || `AUTH_AUTHENTIK_ISSUER` | Required | The OpenID Configuration Issuer from the Authentik application provider details page |- | `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It only needs to be set when the default generated redirect address is incorrect. `https://example.com/api/auth` |+ | `AUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It only needs to be set when the default generated redirect address is incorrect. `https://example.com/api/auth` |<Callout type={'tip'}>Go to [📘 Environment Variables](/docs/self-hosting/environment-variable#Authentik) for details about the variables.diff --git a/docs/self-hosting/advanced/auth/next-auth/authentik.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/authentik.zh-CN.mdxindex e3624c934fa..aa7ed8b2ed1 100644--- a/docs/self-hosting/advanced/auth/next-auth/authentik.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/authentik.zh-CN.mdx@@ -45,12 +45,12 @@ tags:| 环境变量 | 类型 | 描述 || ------------------------- | -- | ------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |+ | `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Authentik 请填写 `authentik`。 || `AUTH_AUTHENTIK_ID` | 必选 | Authentik 提供程序详情页的 客户端 ID || `AUTH_AUTHENTIK_SECRET` | 必选 | Authentik 提供程序详情页的 客户端 Secret || `AUTH_AUTHENTIK_ISSUER` | 必选 | Authentik 提供程序详情页的 OpenID 配置颁发者 |- | `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |+ | `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |<Callout type={'tip'}>前往 [📘 环境变量](/zh/docs/self-hosting/environment-variable#Authentik) 可查阅相关变量详情。diff --git a/docs/self-hosting/advanced/auth/next-auth/casdoor.mdx b/docs/self-hosting/advanced/auth/next-auth/casdoor.mdxindex 3fc07a44ea2..e847adfc1be 100644--- a/docs/self-hosting/advanced/auth/next-auth/casdoor.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/casdoor.mdx@@ -134,12 +134,12 @@ If you are deploying using a public network, the following assumptions apply:| Environment Variable | Type | Description || ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | Required | A key for encrypting Auth.js session tokens. You can generate a key using the command: `openssl rand -base64 32`. |+ | `AUTH_SECRET` | Required | A key for encrypting Auth.js session tokens. You can generate a key using the command: `openssl rand -base64 32`. || `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. Fill in `casdoor` for using Casdoor. || `AUTH_CASDOOR_ID` | Required | The client ID from the Casdoor application details page. || `AUTH_CASDOOR_SECRET` | Required | The client secret from the Casdoor application details page. || `AUTH_CASDOOR_ISSUER` | Required | The OpenID Connect issuer for the Casdoor provider. |- | `NEXTAUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification and needs to be set only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |+ | `AUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification and needs to be set only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` || `CASDOOR_WEBHOOK_SECRET` | Optional | A key used to verify whether the request sent by Casdoor is legal. |<Callout type={'tip'}>diff --git a/docs/self-hosting/advanced/auth/next-auth/casdoor.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/casdoor.zh-CN.mdxindex 2723d4761f6..b16170277e0 100644--- a/docs/self-hosting/advanced/auth/next-auth/casdoor.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/casdoor.zh-CN.mdx@@ -133,12 +133,12 @@ tags:| 环境变量 | 类型 | 描述 || ------------------------- | -- | ------------------------------------------------------------------------------------------------ |- | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |+ | `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Casdoor 请填写 `casdoor`。 || `AUTH_CASDOOR_ID` | 必选 | Casdoor 应用详情页的客户端 ID || `AUTH_CASDOOR_SECRET` | 必选 | Casdoor 应用详情页的客户端密钥 || `AUTH_CASDOOR_ISSUER` | 必选 | Casdoor 提供程序的 OpenID Connect 颁发者。 |- | `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` |+ | `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` || `CASDOOR_WEBHOOK_SECRET` | 可选 | 用于验证 Casdoor 发送的 Webhook 请求是否合法的密钥。 |<Callout type={'tip'}>diff --git a/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.mdx b/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.mdxindex 4a41688d331..dc8d9a51bff 100644--- a/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.mdx@@ -48,12 +48,12 @@ tags:| Environment Variable | Type | Description || ----------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` |+ | `AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the SSO provider for LoboChat. Use `cloudflare-zero-trust` for Cloudflare Zero Trust. || `AUTH_CLOUDFLARE_ZERO_TRUST_ID` | Required | The Client ID from the Cloudflare Zero Trust application provider details page || `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET` | Required | The Client Secret from the Cloudflare Zero Trust application provider details page || `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` | Required | The OpenID Configuration Issuer from the Cloudflare Zero Trust application provider details page |- | `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It only needs to be set when the default generated redirect address is incorrect. `https://example.com/api/auth` |+ | `AUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It only needs to be set when the default generated redirect address is incorrect. `https://example.com/api/auth` |<Callout type={'tip'}>Go to [📘 Environment Variables](/docs/self-hosting/environment-variable#Cloudflare%20Zero%20Trust) for details about the variables.diff --git a/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.zh-CN.mdxindex 8aad2b2d4bb..e490ce4f360 100644--- a/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.zh-CN.mdx@@ -46,12 +46,12 @@ tags:| 环境变量 | 类型 | 描述 || ----------------------------------- | -- | ------------------------------------------------------------------------------------------------------------ |- | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |+ | `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Cloudflare Zero Trust 请填写 `cloudflare-zero-trust`。 || `AUTH_CLOUDFLARE_ZERO_TRUST_ID` | 必选 | 在 Cloudflare Zero Trust 生成的 `Client ID`,示例值是 `lobe-chat` || `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET` | 必选 | 在 Cloudflare Zero Trust 生成的 `Client secret`,示例值是 `insecure_secret` || `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` | 必选 | 在 Cloudflare Zero Trust 生成的 `Issuer`,例如 `https://example.cloudflareaccess.com/cdn-cgi/access/sso/oidc/7db0f` |- | `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://chat.example.com/api/auth` |+ | `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://chat.example.com/api/auth` |<Callout type={'tip'}>前往 [📘 环境变量](/zh/docs/self-hosting/environment-variable#Cloudflare%20Zero%20Trust) 可查阅相关变量详情。diff --git a/docs/self-hosting/advanced/auth/next-auth/github.mdx b/docs/self-hosting/advanced/auth/next-auth/github.mdxindex 2ab5da637d7..96cd38c18a3 100644--- a/docs/self-hosting/advanced/auth/next-auth/github.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/github.mdx@@ -54,11 +54,11 @@ tags:| Environment Variable | Type | Description || ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the command: `openssl rand -base64 32` |+ | `AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the command: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the Single Sign-On provider for LobeChat. Use `github` for Github. || `AUTH_GITHUB_ID` | Required | Client ID in the Github App details page. || `AUTH_GITHUB_SECRET` | Required | Client Secret in the Github App details page. |- | `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. Only set it if the default generated redirect address is incorrect. `https://example.com/api/auth` |+ | `AUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. Only set it if the default generated redirect address is incorrect. `https://example.com/api/auth` |<Callout type={'tip'}>Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#github) for detaileddiff --git a/docs/self-hosting/advanced/auth/next-auth/github.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/github.zh-CN.mdxindex 3417cd7acfb..7ad231731c8 100644--- a/docs/self-hosting/advanced/auth/next-auth/github.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/github.zh-CN.mdx@@ -52,11 +52,11 @@ tags:| 环境变量 | 类型 | 描述 || ------------------------- | -- | ------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |+ | `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Github 请填写 `github`。 || `AUTH_GITHUB_ID` | 必选 | Github App 详情页的 客户端 ID || `AUTH_GITHUB_SECRET` | 必选 | Github App 详情页的 客户端 Secret |- | `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |+ | `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |<Callout type={'tip'}>前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#github) 可查阅相关变量详情。diff --git a/docs/self-hosting/advanced/auth/next-auth/google.mdx b/docs/self-hosting/advanced/auth/next-auth/google.mdxindex 4f60d0c4d31..79cc188eb39 100644--- a/docs/self-hosting/advanced/auth/next-auth/google.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/google.mdx@@ -21,49 +21,52 @@ tags:<Steps>### Create a Google Cloud OAuth 2.0 Client-In your [Google Cloud Console][google-cloud-console], navigate to **APIs & Services > Credentials**.+ In your [Google Cloud Console][google-cloud-console], navigate to **APIs & Services > Credentials**.-Click on **Create Credentials** and select **OAuth client ID**.+ Click on **Create Credentials** and select **OAuth client ID**.-If you haven't already set up a consent screen, you will be prompted to do so. Complete the OAuth consent screen setup (specify app name, support email, and add authorized users if needed).+ If you haven't already set up a consent screen, you will be prompted to do so. Complete the OAuth consent screen setup (specify app name, support email, and add authorized users if needed).-Select **Web application** as the application type.+ Select **Web application** as the application type.-In the **Authorized redirect URIs** section, enter:+ In the **Authorized redirect URIs** section, enter:-```bash-https://your-domain/api/auth/callback/google-```+ ```bash+ https://your-domain/api/auth/callback/google+ ```-\<Callout type={'info'}>-\- You can add or modify redirect URIs after registration, but make sure the URL matches your deployed LobeChat instance.-\- Replace "your-domain" with your actual domain. </Callout>+ <Callout type={'info'}>+ \- You can add or modify redirect URIs after registration, but make sure the URL matches your deployed LobeChat instance.+ \- Replace "your-domain" with your actual domain.+ </Callout>-Click **Create**.+ Click **Create**.-After creation, copy the **Client ID** and **Client Secret**.+ After creation, copy the **Client ID** and **Client Secret**.<Image alt="Google OAuth Setup" inStep src="https://developers.google.com/static/identity/images/gsi/web/gcs-signin-2.png" />-### Add Users (Optional for Internal Use Only)+ ### Add Users (Optional for Internal Use Only)-If your application is in **Testing** or **Internal** publishing status, add user emails in the OAuth consent screen under **Test users**.-Users not added here will not be able to authenticate.+ If your application is in **Testing** or **Internal** publishing status, add user emails in the OAuth consent screen under **Test users**.+ Users not added here will not be able to authenticate.-### Configure Environment Variables+ ### Configure Environment Variables-When deploying LobeChat, configure the following environment variables:+ When deploying LobeChat, configure the following environment variables:-| Environment Variable | Type | Description |-| ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |-| `NEXT_AUTH_SECRET` | Required | Key to encrypt Auth.js session tokens. Generate using: `openssl rand -base64 32` |-| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. Use `google` for Google SSO. |-| `AUTH_GOOGLE_ID` | Required | Client ID from Google Cloud OAuth. |-| `AUTH_GOOGLE_SECRET` | Required | Client Secret from Google Cloud OAuth. |-| `NEXTAUTH_URL` | Required | Specifies the callback address for Auth.js when performing OAuth authentication. E.g. `https://your-domain/api/auth` |+ | Environment Variable | Type | Description |+ | ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |+ | `NEXT_AUTH_SECRET` | Required | Key to encrypt Auth.js session tokens. Generate using: `openssl rand -base64 32` |+ | `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. Use `google` for Google SSO. |+ | `AUTH_GOOGLE_ID` | Required | Client ID from Google Cloud OAuth. |+ | `AUTH_GOOGLE_SECRET` | Required | Client Secret from Google Cloud OAuth. |+ | `AUTH_URL` | Required | Specifies the callback address for Auth.js when performing OAuth authentication. E.g. `https://your-domain/api/auth` |-\<Callout type={'tip'}>-See [📘 environment variables](/docs/self-hosting/environment-variable#google) for more details on these variables. </Callout> </Steps>+ <Callout type={'tip'}>+ See [📘 environment variables](/docs/self-hosting/environment-variable#google) for more details on these variables.+ </Callout>+</Steps><Callout>After successful deployment, users can sign in to LobeChat using their Google accounts (those added as Test Users, if not in production).@@ -75,8 +78,8 @@ See the [Google Identity Platform Documentation][google-identity-docs] for advan## Related Resources-* [Quickstart: Configure a Google OAuth client][google-oauth-quickstart]+- [Quickstart: Configure a Google OAuth client][google-oauth-quickstart][google-cloud-console]: https://console.cloud.google.com/apis/credentials-[google-oauth-quickstart]: https://developers.google.com/identity/protocols/oauth2/web-server#creatingcred[google-identity-docs]: https://developers.google.com/identity+[google-oauth-quickstart]: https://developers.google.com/identity/protocols/oauth2/web-server#creatingcreddiff --git a/docs/self-hosting/advanced/auth/next-auth/keycloak.mdx b/docs/self-hosting/advanced/auth/next-auth/keycloak.mdxindex b6fb39e4afc..c73f8576cea 100644--- a/docs/self-hosting/advanced/auth/next-auth/keycloak.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/keycloak.mdx@@ -108,12 +108,12 @@ If you deploy using a public network, this guide assumes:| Environment Variable | Type | Description || ------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using: `openssl rand -base64 32` |+ | `AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. For Keycloak, fill in `keycloak`. || `AUTH_KEYCLOAK_ID` | Required | Keycloak client ID || `AUTH_KEYCLOAK_SECRET` | Required | Keycloak client secret || `AUTH_KEYCLOAK_ISSUER` | Required | OpenID Connect issuer URL for the Keycloak provider, in the format `{keycloak_url}/realms/{realm_name}` |- | `NEXTAUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification. Only needed when the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |+ | `AUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification. Only needed when the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |<Callout type={'tip'}>Visit [📘 Environment Variables](/zh/docs/self-hosting/environment-variables/auth#keycloak) for details on related variables.diff --git a/docs/self-hosting/advanced/auth/next-auth/keycloak.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/keycloak.zh-CN.mdxindex c7e0293da3a..84107a933a1 100644--- a/docs/self-hosting/advanced/auth/next-auth/keycloak.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/keycloak.zh-CN.mdx@@ -105,12 +105,12 @@ tags:| 环境变量 | 类型 | 描述 || ------------------------- | -- | ------------------------------------------------------------------------------------------------ |- | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |+ | `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Keycloak 请填写 `keycloak`。 || `AUTH_KEYCLOAK_ID` | 必选 | Keycloak 客户端 ID || `AUTH_KEYCLOAK_SECRET` | 必选 | Keycloak 客户端密钥 || `AUTH_KEYCLOAK_ISSUER` | 必选 | Keycloak 提供程序的 OpenID Connect 颁发者 URL,格式为 `{keycloak_url}/realms/{realm_name}` |- | `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` |+ | `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` |<Callout type={'tip'}>前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#keycloak) 可查阅相关变量详情。diff --git a/docs/self-hosting/advanced/auth/next-auth/logto.mdx b/docs/self-hosting/advanced/auth/next-auth/logto.mdxindex eac89387760..e1a0ece7ca4 100644--- a/docs/self-hosting/advanced/auth/next-auth/logto.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/logto.mdx@@ -50,7 +50,9 @@ If you are using Logto Cloud, assume its endpoint domain is `https://example.logGo to `Webhooks`, create a Webhook, and fill in the following fields:- Endpoint URL: `https://lobe.example.com/api/webhooks/logto`- - Events: `User.Data.Updated`+ - Events:+ - `User.Data.Updated`: Allow LobeChat to synchronize user profile information updates from Logto.+ - `User.SuspensionStatus.Updated`: Allow LobeChat to remove the active session from suspended users from logging in, only available when database session strategy is `database`.After successful creation, copy the Webhook's `Signing Key` and fill it in the `LOGTO_WEBHOOK_SIGNING_KEY` environment variable.@@ -69,12 +71,12 @@ If you are using Logto Cloud, assume its endpoint domain is `https://example.log| Environment Variable | Type | Description || --------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | Required | The key used to encrypt Auth.js session tokens. You can generate a key using the command: `openssl rand -base64 32` |+ | `AUTH_SECRET` | Required | The key used to encrypt Auth.js session tokens. You can generate a key using the command: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. For Logto, enter `logto`. || `AUTH_LOGTO_ID` | Required | The Client ID from the Logto App details page || `AUTH_LOGTO_SECRET` | Required | The Client Secret from the Logto App details page || `AUTH_LOGTO_ISSUER` | Required | OpenID Connect issuer of the Logto provider |- | `NEXTAUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification, needed only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |+ | `AUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification, needed only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` || `LOGTO_WEBHOOK_SIGNING_KEY` | Optional | The key used to verify the legality of Webhook requests sent by Logto. |<Callout type={'tip'}>diff --git a/docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdxindex 1575448b71f..2b444545fed 100644--- a/docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdx@@ -47,7 +47,9 @@ tags:前往 `Webhooks` ,创建一个 Webhook,填写以下字段:- 端点 URL: `https://lobe.example.com/api/webhooks/logto`- - 事件: `User.Data.Updated`+ - 事件:+ - `User.Data.Updated`: 允许 LobeChat 同步 Logto 中用户资料信息的更新。+ - `User.SuspensionStatus.Updated`: 允许 LobeChat 将被暂停的用户移除登录会话,仅在数据库会话策略为 `database` 时可用。创建成功后,复制 Webhook 的 `签名密钥`。填写到环境变量中的 `LOGTO_WEBHOOK_SIGNING_KEY`。@@ -66,12 +68,12 @@ tags:| 环境变量 | 类型 | 描述 || --------------------------- | -- | ------------------------------------------------------------------------------------------------ |- | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |+ | `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Logto 请填写 `logto`。 || `AUTH_LOGTO_ID` | 必选 | Logto App 详情页的 Client ID || `AUTH_LOGTO_SECRET` | 必选 | Logto App 详情页的 Client Secret || `AUTH_LOGTO_ISSUER` | 必选 | Logto 提供程序的 OpenID Connect 颁发者 |- | `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` |+ | `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` || `LOGTO_WEBHOOK_SIGNING_KEY` | 可选 | 用于验证 Logto 发送的 Webhook 请求是否合法的密钥。 |<Callout type={'tip'}>diff --git a/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id.mdx b/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id.mdxindex be032e5fdcb..d453b8159b4 100644--- a/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id.mdx@@ -58,12 +58,12 @@ tags:| Environment Variable | Type | Description || ----------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the following command: `openssl rand -base64 32` |+ | `AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the following command: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `microsoft-entra-id` for Microsoft Entra ID. || `AUTH_MICROSOFT_ENTRA_ID_ID` | Required | Client ID of the Microsoft Entra ID application. || `AUTH_MICROSOFT_ENTRA_ID_SECRET` | Required | Client Secret of the Microsoft Entra ID application. || `AUTH_MICROSOFT_ENTRA_ID_TENANT_ID` | Required | Tenant ID of the Microsoft Entra ID application. |- | `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It is only necessary to set it when the default generated redirect address is incorrect. `https://example.com/api/auth` |+ | `AUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It is only necessary to set it when the default generated redirect address is incorrect. `https://example.com/api/auth` |<Callout type={'tip'}>You can refer to [📘 environmentdiff --git a/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id.zh-CN.mdxindex 5df442de866..6202bba093b 100644--- a/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id.zh-CN.mdx@@ -56,12 +56,12 @@ tags:| 环境变量 | 类型 | 描述 || ----------------------------------- | -- | ------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |+ | `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Microsoft Entra ID 请填写 `microsoft-entra-id`。 || `AUTH_MICROSOFT_ENTRA_ID_ID` | 必选 | Microsoft Entra ID 应用程序的 Client ID || `AUTH_MICROSOFT_ENTRA_ID_SECRET` | 必选 | Microsoft Entra ID 应用程序的 Client Secret || `AUTH_MICROSOFT_ENTRA_ID_TENANT_ID` | 必选 | Microsoft Entra ID 应用程序的 Tenant ID |- | `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |+ | `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |<Callout type={'tip'}>前往 [📘 环境变量](/zh/docs/self-hosting/environment-variable#microsoft-entra-id) 可查阅相关变量详情。diff --git a/docs/self-hosting/advanced/auth/next-auth/okta.mdx b/docs/self-hosting/advanced/auth/next-auth/okta.mdxindex 88239dbc072..c7f41636a48 100644--- a/docs/self-hosting/advanced/auth/next-auth/okta.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/okta.mdx@@ -45,12 +45,12 @@ tags:| Environment Variable | Type | Description || ------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` |+ | `AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `okta` for Okta. || `AUTH_OKTA_ID` | Required | Client ID of the Okta application || `AUTH_OKTA_SECRET` | Required | Client Secret of the Okta application || `AUTH_OKTA_ISSUER` | Required | Domain of the Okta application, `https://example.oktapreview.com` |- | `NEXTAUTH_URL` | Optional | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |+ | `AUTH_URL` | Optional | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |<Callout type={'tip'}>You can refer to the related variable details at [📘Environment Variables](/docs/self-hosting/environment-variable/auth#okta).diff --git a/docs/self-hosting/advanced/auth/next-auth/okta.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/okta.zh-CN.mdxindex f6362ae30ab..d4426bed6b7 100644--- a/docs/self-hosting/advanced/auth/next-auth/okta.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/okta.zh-CN.mdx@@ -44,12 +44,12 @@ tags:| 环境变量 | 类型 | 描述 || ------------------------- | -- | ------------------------------------------------------------------------------------ |- | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成密钥:`openssl rand -base64 32` |+ | `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成密钥:`openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Okta 请填写 `okta`。 || `AUTH_OKTA_ID` | 必选 | Okta 应用程序的客户端 ID || `AUTH_OKTA_SECRET` | 必选 | Okta 应用程序的客户端密钥 || `AUTH_OKTA_ISSUER` | 必选 | Okta 应用程序的域名,`https://example.oktapreview.com` |- | `NEXTAUTH_URL` | 可选 | 该 URL 用于指定 Auth.js 在执行 OAuth 认证时的回调地址。仅当默认地址不正确时才需要设置。`https://example.com/api/auth` |+ | `AUTH_URL` | 可选 | 该 URL 用于指定 Auth.js 在执行 OAuth 认证时的回调地址。仅当默认地址不正确时才需要设置。`https://example.com/api/auth` |<Callout type={'tip'}>您可以在 [📘环境变量](/zh/docs/self-hosting/environment-variables/auth#okta) 查阅相关变量详情。diff --git a/docs/self-hosting/advanced/auth/next-auth/wechat.mdx b/docs/self-hosting/advanced/auth/next-auth/wechat.mdxindex 06fd91ae45e..33bec156602 100644--- a/docs/self-hosting/advanced/auth/next-auth/wechat.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/wechat.mdx@@ -30,11 +30,11 @@ tags:| Environment Variable | Type | Description || ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the command: `openssl rand -base64 32` |+ | `AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the command: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the Single Sign-On provider for LobeChat. Use `github` for Github. || `WECHAT_CLIENT_ID` | Required | Client ID from the Wechat website application details page || `WECHAT_CLIENT_SECRET` | Required | Client Secret from the Wechat website application details page |- | `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. Only set it if the default generated redirect address is incorrect. `https://example.com/api/auth` |+ | `AUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. Only set it if the default generated redirect address is incorrect. `https://example.com/api/auth` |<Callout type={'tip'}>Go to [📘 Environment Variables](/en/docs/self-hosting/environment-variables/auth#wechat) for more details about related variables.diff --git a/docs/self-hosting/advanced/auth/next-auth/wechat.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/wechat.zh-CN.mdxindex 8c710c27d68..774dea7bb7e 100644--- a/docs/self-hosting/advanced/auth/next-auth/wechat.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/wechat.zh-CN.mdx@@ -28,11 +28,11 @@ tags:| 环境变量 | 类型 | 描述 || ------------------------- | -- | ------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |+ | `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Github 请填写 `github`。 || `WECHAT_CLIENT_ID` | 必选 | 微信网站应用详情页的 客户端 ID || `WECHAT_CLIENT_SECRET` | 必选 | 微信网站应用详情页的 客户端 Secret |- | `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |+ | `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |<Callout type={'tip'}>前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#wechat) 可查阅相关变量详情。diff --git a/docs/self-hosting/advanced/auth/next-auth/zitadel.mdx b/docs/self-hosting/advanced/auth/next-auth/zitadel.mdxindex a56207d8456..d0576686597 100644--- a/docs/self-hosting/advanced/auth/next-auth/zitadel.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/zitadel.mdx@@ -65,12 +65,12 @@ tags:| Environment Variable | Type | Description || ------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` |+ | `AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `zitadel` for ZITADEL. || `AUTH_ZITADEL_ID` | Required | Client ID (`ClientId` as shown in ZITADEL) of the ZITADEL application || `AUTH_ZITADEL_SECRET` | Required | Client Secret (`ClientSecret` as shown in ZITADEL) of the ZITADEL application || `AUTH_ZITADEL_ISSUER` | Required | Issuer URL of the ZITADEL application |- | `NEXTAUTH_URL` | Required | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |+ | `AUTH_URL` | Required | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |<Callout type={'tip'}>You can refer to the related variable details at [📘Environment Variables](/docs/self-hosting/environment-variables/auth#zitadel).diff --git a/docs/self-hosting/advanced/auth/next-auth/zitadel.zh-CN.mdx b/docs/self-hosting/advanced/auth/next-auth/zitadel.zh-CN.mdxindex 499afb9cc5d..f4c30deafa4 100644--- a/docs/self-hosting/advanced/auth/next-auth/zitadel.zh-CN.mdx+++ b/docs/self-hosting/advanced/auth/next-auth/zitadel.zh-CN.mdx@@ -62,12 +62,12 @@ tags:| 环境变量 | 类型 | 描述 || ------------------------- | -- | ----------------------------------------------------------------------------------- |- | `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成密钥:`openssl rand -base64 32` |+ | `AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成密钥:`openssl rand -base64 32` || `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 为 LobeChat 选择单点登录提供程序。对于 ZITADEL,请填写 `zitadel`。 || `AUTH_ZITADEL_ID` | 必选 | ZITADEL 应用的 Client ID(`ClientId`)。 || `AUTH_ZITADEL_SECRET` | 必选 | ZITADEL 应用的 Client Secret(`ClientSecret`)。 || `AUTH_ZITADEL_ISSUER` | 必选 | ZITADEL 应用的 OpenID Connect 颁发者(issuer)URL。 |- | `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 中执行 OAuth 认证的回调地址。仅当默认地址不正确时才需要设置。`https://example.com/api/auth` |+ | `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 中执行 OAuth 认证的回调地址。仅当默认地址不正确时才需要设置。`https://example.com/api/auth` |<Callout type={'tip'}>您可以在 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#zitadel) 中查看相关变量的详细信息。diff --git a/src/envs/__tests__/auth.test.ts b/src/envs/__tests__/auth.test.tsdeleted file mode 100644index 632393f2496..00000000000--- a/src/envs/__tests__/auth.test.ts+++ /dev/null@@ -1,200 +0,0 @@-// @vitest-environment node-import { beforeEach, describe, expect, it, vi } from 'vitest';--import { getAuthConfig } from '../auth';--// Stub the global process object to safely mock environment variables-vi.stubGlobal('process', {- ...process, // Preserve the original process object- env: { ...process.env }, // Clone the environment variables object for modification-});--const spyConsoleWarn = vi.spyOn(console, 'warn');--describe('getAuthConfig', () => {- beforeEach(() => {- // Clear all environment variables before each test- // @ts-expect-error- process.env = {};- });-- // TODO(NextAuth ENVs Migration): Remove once nextauth envs migration time end- describe('should warn about deprecated environment variables', () => {- it('should warn about Auth0 deprecated environment variables', () => {- // Set all deprecated environment variables- process.env.AUTH0_CLIENT_ID = 'auth0_client_id';- process.env.AUTH0_CLIENT_SECRET = 'auth0_client_secret';- process.env.AUTH0_ISSUER = 'auth0_issuer';- // Call the function- getAuthConfig();-- // Check that the spyConsoleWarn function was called for each deprecated environment variable- // Example: A warning meassage should incloud: `<Old Env> .* <New Env>`- // And the regex should match the warning message: `AUTH0_CLIENT_ID.*AUTH_AUTH0_ID`- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/AUTH0_CLIENT_ID.*AUTH_AUTH0_ID/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/AUTH0_CLIENT_SECRET.*AUTH_AUTH0_SECRET/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/AUTH0_ISSUER.*AUTH_AUTH0_ISSUER/),- );- });- it('should warn about Authentik deprecated environment variables', () => {- // Set all deprecated environment variables- process.env.AUTHENTIK_CLIENT_ID = 'authentik_client_id';- process.env.AUTHENTIK_CLIENT_SECRET = 'authentik_client_secret';- process.env.AUTHENTIK_ISSUER = 'authentik_issuer';-- // Call the function- getAuthConfig();-- // Check that the spyConsoleWarn function was called for each deprecated environment variable- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/AUTHENTIK_CLIENT_ID.*AUTH_AUTHENTIK_ID/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/AUTHENTIK_CLIENT_SECRET.*AUTH_AUTHENTIK_SECRET/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/AUTHENTIK_ISSUER.*AUTH_AUTHENTIK_ISSUER/),- );- });- it('should warn about Authelia deprecated environment variables', () => {- // Set all deprecated environment variables- process.env.AUTHELIA_CLIENT_ID = 'authelia_client_id';- process.env.AUTHELIA_CLIENT_SECRET = 'authelia_client_secret';- process.env.AUTHELIA_ISSUER = 'authelia_issuer';-- // Call the function- getAuthConfig();-- // Check that the spyConsoleWarn function was called for each deprecated environment variable- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/AUTHELIA_CLIENT_ID.*AUTH_AUTHELIA_ID/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/AUTHELIA_CLIENT_SECRET.*AUTH_AUTHELIA_SECRET/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/AUTHELIA_ISSUER.*AUTH_AUTHELIA_ISSUER/),- );- });- it('should warn about AzureAD deprecated environment variables', () => {- // Set all deprecated environment variables- process.env.AZURE_AD_CLIENT_ID = 'azure_ad_client_id';- process.env.AZURE_AD_CLIENT_SECRET = 'azure_ad_client_secret';- process.env.AZURE_AD_TENANT_ID = 'azure_ad_tenant_id';-- // Call the function- getAuthConfig();-- // Check that the spyConsoleWarn function was called for each deprecated environment variable- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/AZURE_AD_CLIENT_ID.*AUTH_AZURE_AD_ID/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/AZURE_AD_CLIENT_SECRET.*AUTH_AZURE_AD_SECRET/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/AZURE_AD_TENANT_ID.*AUTH_AZURE_AD_TENANT_ID/),- );- });- it('should warn about Cloudflare Zero Trust deprecated environment variables', () => {- // Set all deprecated environment variables- process.env.CLOUDFLARE_ZERO_TRUST_CLIENT_ID = 'cloudflare_zero_trust_client_id';- process.env.CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET = 'cloudflare_zero_trust_client_secret';- process.env.CLOUDFLARE_ZERO_TRUST_ISSUER = 'cloudflare_zero_trust_issuer';-- // Call the function- getAuthConfig();-- // Check that the spyConsoleWarn function was called for each deprecated environment variable- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/CLOUDFLARE_ZERO_TRUST_CLIENT_ID.*AUTH_CLOUDFLARE_ZERO_TRUST_ID/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(- /CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET.*AUTH_CLOUDFLARE_ZERO_TRUST_SECRET/,- ),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/CLOUDFLARE_ZERO_TRUST_ISSUER.*AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER/),- );- });- it('should warn about Generic OIDC deprecated environment variables', () => {- // Set all deprecated environment variables- process.env.GENERIC_OIDC_CLIENT_ID = 'generic_oidc_client_id';- process.env.GENERIC_OIDC_CLIENT_SECRET = 'generic_oidc_client_secret';- process.env.GENERIC_OIDC_ISSUER = 'generic_oidc_issuer';- // Call the function- getAuthConfig();-- // Check that the spyConsoleWarn function was called for each deprecated environment variable- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/GENERIC_OIDC_CLIENT_ID.*AUTH_GENERIC_OIDC_ID/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/GENERIC_OIDC_CLIENT_SECRET.*AUTH_GENERIC_OIDC_SECRET/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/GENERIC_OIDC_ISSUER.*AUTH_GENERIC_OIDC_ISSUER/),- );- });- it('should warn about GitHub deprecated environment variables', () => {- // Set all deprecated environment variables- process.env.GITHUB_CLIENT_ID = 'github_client_id';- process.env.GITHUB_CLIENT_SECRET = 'github_client_secret';- // Call the function- getAuthConfig();-- // Check that the spyConsoleWarn function was called for each deprecated environment variable- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/GITHUB_CLIENT_ID.*AUTH_GITHUB_ID/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/GITHUB_CLIENT_SECRET.*AUTH_GITHUB_SECRET/),- );- });- it('should warn about Logto deprecated environment variables', () => {- // Set all deprecated environment variables- process.env.LOGTO_CLIENT_ID = 'logto_client_id';- process.env.LOGTO_CLIENT_SECRET = 'logto_client_secret';- process.env.LOGTO_ISSUER = 'logto_issuer';- // Call the function- getAuthConfig();-- // Check that the spyConsoleWarn function was called for each deprecated environment variable- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/LOGTO_CLIENT_ID.*AUTH_LOGTO_ID/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/LOGTO_CLIENT_SECRET.*AUTH_LOGTO_SECRET/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/LOGTO_ISSUER.*AUTH_LOGTO_ISSUER/),- );- });- it('should warn about Zitadel deprecated environment variables', () => {- // Set all deprecated environment variables- process.env.ZITADEL_CLIENT_ID = 'zitadel_client_id';- process.env.ZITADEL_CLIENT_SECRET = 'zitadel_client_secret';- process.env.ZITADEL_ISSUER = 'zitadel_issuer';- // Call the function- getAuthConfig();-- // Check that the spyConsoleWarn function was called for each deprecated environment variable- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/ZITADEL_CLIENT_ID.*AUTH_ZITADEL_ID/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/ZITADEL_CLIENT_SECRET.*AUTH_ZITADEL_SECRET/),- );- expect(spyConsoleWarn).toHaveBeenCalledWith(- expect.stringMatching(/ZITADEL_ISSUER.*AUTH_ZITADEL_ISSUER/),- );- });- });- // Remove end-});diff --git a/src/envs/auth.ts b/src/envs/auth.tsindex d3529013ffe..8562f286ace 100644--- a/src/envs/auth.ts+++ b/src/envs/auth.ts@@ -20,10 +20,6 @@ declare global {NEXT_AUTH_SSO_SESSION_STRATEGY?: string;- AUTH0_CLIENT_ID?: string;- AUTH0_CLIENT_SECRET?: string;- AUTH0_ISSUER?: string;-// GithubGITHUB_CLIENT_ID?: string;GITHUB_CLIENT_SECRET?: string;@@ -33,11 +29,6 @@ declare global {AZURE_AD_CLIENT_SECRET?: string;AZURE_AD_TENANT_ID?: string;- // AUTHENTIK- AUTHENTIK_CLIENT_ID?: string;- AUTHENTIK_CLIENT_SECRET?: string;- AUTHENTIK_ISSUER?: string;-// ZITADELZITADEL_CLIENT_ID?: string;ZITADEL_CLIENT_SECRET?: string;@@ -46,102 +37,7 @@ declare global {}}-// TODO(NextAuth ENVs Migration): Remove once nextauth envs migration time end-const removeTipsTemplate = (willBeRemoved: string, replaceOne: string) =>- `${willBeRemoved} will be removed in the future. Please set ${replaceOne} instead.`;-// End-export const getAuthConfig = () => {- // TODO(NextAuth ENVs Migration): Remove once nextauth envs migration time end- if (process.env.AUTH0_CLIENT_ID) {- console.warn(removeTipsTemplate('AUTH0_CLIENT_ID', 'AUTH_AUTH0_ID'));- }- if (process.env.AUTH0_CLIENT_SECRET) {- console.warn(removeTipsTemplate('AUTH0_CLIENT_SECRET', 'AUTH_AUTH0_SECRET'));- }- if (process.env.AUTH0_ISSUER) {- console.warn(removeTipsTemplate('AUTH0_ISSUER', 'AUTH_AUTH0_ISSUER'));- }- if (process.env.AUTHENTIK_CLIENT_ID) {- console.warn(removeTipsTemplate('AUTHENTIK_CLIENT_ID', 'AUTH_AUTHENTIK_ID'));- }- if (process.env.AUTHENTIK_CLIENT_SECRET) {- console.warn(removeTipsTemplate('AUTHENTIK_CLIENT_SECRET', 'AUTH_AUTHENTIK_SECRET'));- }- if (process.env.AUTHENTIK_ISSUER) {- console.warn(removeTipsTemplate('AUTHENTIK_ISSUER', 'AUTH_AUTHENTIK_ISSUER'));- }- if (process.env.AUTHELIA_CLIENT_ID) {- console.warn(removeTipsTemplate('AUTHELIA_CLIENT_ID', 'AUTH_AUTHELIA_ID'));- }- if (process.env.AUTHELIA_CLIENT_SECRET) {- console.warn(removeTipsTemplate('AUTHELIA_CLIENT_SECRET', 'AUTH_AUTHELIA_SECRET'));- }- if (process.env.AUTHELIA_ISSUER) {- console.warn(removeTipsTemplate('AUTHELIA_ISSUER', 'AUTH_AUTHELIA_ISSUER'));- }- if (process.env.AZURE_AD_CLIENT_ID) {- console.warn(removeTipsTemplate('AZURE_AD_CLIENT_ID', 'AUTH_AZURE_AD_ID'));- }- if (process.env.AZURE_AD_CLIENT_SECRET) {- console.warn(removeTipsTemplate('AZURE_AD_CLIENT_SECRET', 'AUTH_AZURE_AD_SECRET'));- }- if (process.env.AZURE_AD_TENANT_ID) {- console.warn(removeTipsTemplate('AZURE_AD_TENANT_ID', 'AUTH_AZURE_AD_TENANT_ID'));- }- if (process.env.CLOUDFLARE_ZERO_TRUST_CLIENT_ID) {- console.warn(- removeTipsTemplate('CLOUDFLARE_ZERO_TRUST_CLIENT_ID', 'AUTH_CLOUDFLARE_ZERO_TRUST_ID'),- );- }- if (process.env.CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET) {- console.warn(- removeTipsTemplate(- 'CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET',- 'AUTH_CLOUDFLARE_ZERO_TRUST_SECRET',- ),- );- }- if (process.env.CLOUDFLARE_ZERO_TRUST_ISSUER) {- console.warn(- removeTipsTemplate('CLOUDFLARE_ZERO_TRUST_ISSUER', 'AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER'),- );- }- if (process.env.GENERIC_OIDC_CLIENT_ID) {- console.warn(removeTipsTemplate('GENERIC_OIDC_CLIENT_ID', 'AUTH_GENERIC_OIDC_ID'));- }- if (process.env.GENERIC_OIDC_CLIENT_SECRET) {- console.warn(removeTipsTemplate('GENERIC_OIDC_CLIENT_SECRET', 'AUTH_GENERIC_OIDC_SECRET'));- }- if (process.env.GENERIC_OIDC_ISSUER) {- console.warn(removeTipsTemplate('GENERIC_OIDC_ISSUER', 'AUTH_GENERIC_OIDC_ISSUER'));- }- if (process.env.GITHUB_CLIENT_ID) {- console.warn(removeTipsTemplate('GITHUB_CLIENT_ID', 'AUTH_GITHUB_ID'));- }- if (process.env.GITHUB_CLIENT_SECRET) {- console.warn(removeTipsTemplate('GITHUB_CLIENT_SECRET', 'AUTH_GITHUB_SECRET'));- }- if (process.env.LOGTO_CLIENT_ID) {- console.warn(removeTipsTemplate('LOGTO_CLIENT_ID', 'AUTH_LOGTO_ID'));- }- if (process.env.LOGTO_CLIENT_SECRET) {- console.warn(removeTipsTemplate('LOGTO_CLIENT_SECRET', 'AUTH_LOGTO_SECRET'));- }- if (process.env.LOGTO_ISSUER) {- console.warn(removeTipsTemplate('LOGTO_ISSUER', 'AUTH_LOGTO_ISSUER'));- }- if (process.env.ZITADEL_CLIENT_ID) {- console.warn(removeTipsTemplate('ZITADEL_CLIENT_ID', 'AUTH_ZITADEL_ID'));- }- if (process.env.ZITADEL_CLIENT_SECRET) {- console.warn(removeTipsTemplate('ZITADEL_CLIENT_SECRET', 'AUTH_ZITADEL_SECRET'));- }- if (process.env.ZITADEL_ISSUER) {- console.warn(removeTipsTemplate('ZITADEL_ISSUER', 'AUTH_ZITADEL_ISSUER'));- }- // End-return createEnv({client: {NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string().optional(),@@ -163,49 +59,11 @@ export const getAuthConfig = () => {NEXT_AUTH_DEBUG: z.boolean().optional().default(false),NEXT_AUTH_SSO_SESSION_STRATEGY: z.enum(['jwt', 'database']).optional().default('jwt'),- // Auth0- AUTH0_CLIENT_ID: z.string().optional(),- AUTH0_CLIENT_SECRET: z.string().optional(),- AUTH0_ISSUER: z.string().optional(),-- // Github- GITHUB_CLIENT_ID: z.string().optional(),- GITHUB_CLIENT_SECRET: z.string().optional(),-// Azure ADAZURE_AD_CLIENT_ID: z.string().optional(),AZURE_AD_CLIENT_SECRET: z.string().optional(),AZURE_AD_TENANT_ID: z.string().optional(),- // AUTHENTIK- AUTHENTIK_CLIENT_ID: z.string().optional(),- AUTHENTIK_CLIENT_SECRET: z.string().optional(),- AUTHENTIK_ISSUER: z.string().optional(),-- // AUTHELIA- AUTHELIA_CLIENT_ID: z.string().optional(),- AUTHELIA_CLIENT_SECRET: z.string().optional(),- AUTHELIA_ISSUER: z.string().optional(),-- // Cloudflare Zero Trust- CLOUDFLARE_ZERO_TRUST_CLIENT_ID: z.string().optional(),- CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET: z.string().optional(),- CLOUDFLARE_ZERO_TRUST_ISSUER: z.string().optional(),-- // Generic OIDC- GENERIC_OIDC_CLIENT_ID: z.string().optional(),- GENERIC_OIDC_CLIENT_SECRET: z.string().optional(),- GENERIC_OIDC_ISSUER: z.string().optional(),-- // ZITADEL- ZITADEL_CLIENT_ID: z.string().optional(),- ZITADEL_CLIENT_SECRET: z.string().optional(),- ZITADEL_ISSUER: z.string().optional(),-- // LOGTO- LOGTO_CLIENT_ID: z.string().optional(),- LOGTO_CLIENT_SECRET: z.string().optional(),- LOGTO_ISSUER: z.string().optional(),LOGTO_WEBHOOK_SIGNING_KEY: z.string().optional(),// Casdoor@@ -226,49 +84,12 @@ export const getAuthConfig = () => {NEXT_AUTH_DEBUG: !!process.env.NEXT_AUTH_DEBUG,NEXT_AUTH_SSO_SESSION_STRATEGY: process.env.NEXT_AUTH_SSO_SESSION_STRATEGY || 'jwt',- // Auth0- AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,- AUTH0_CLIENT_SECRET: process.env.AUTH0_CLIENT_SECRET,- AUTH0_ISSUER: process.env.AUTH0_ISSUER,-- // Github- GITHUB_CLIENT_ID: process.env.GITHUB_CLIENT_ID,- GITHUB_CLIENT_SECRET: process.env.GITHUB_CLIENT_SECRET,-// Azure ADAZURE_AD_CLIENT_ID: process.env.AZURE_AD_CLIENT_ID,AZURE_AD_CLIENT_SECRET: process.env.AZURE_AD_CLIENT_SECRET,AZURE_AD_TENANT_ID: process.env.AZURE_AD_TENANT_ID,- // AUTHENTIK- AUTHENTIK_CLIENT_ID: process.env.AUTHENTIK_CLIENT_ID,- AUTHENTIK_CLIENT_SECRET: process.env.AUTHENTIK_CLIENT_SECRET,- AUTHENTIK_ISSUER: process.env.AUTHENTIK_ISSUER,-- // AUTHELIA- AUTHELIA_CLIENT_ID: process.env.AUTHELIA_CLIENT_ID,- AUTHELIA_CLIENT_SECRET: process.env.AUTHELIA_CLIENT_SECRET,- AUTHELIA_ISSUER: process.env.AUTHELIA_ISSUER,-- // Cloudflare Zero Trust- CLOUDFLARE_ZERO_TRUST_CLIENT_ID: process.env.CLOUDFLARE_ZERO_TRUST_CLIENT_ID,- CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET: process.env.CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET,- CLOUDFLARE_ZERO_TRUST_ISSUER: process.env.CLOUDFLARE_ZERO_TRUST_ISSUER,-- // Generic OIDC- GENERIC_OIDC_CLIENT_ID: process.env.GENERIC_OIDC_CLIENT_ID,- GENERIC_OIDC_CLIENT_SECRET: process.env.GENERIC_OIDC_CLIENT_SECRET,- GENERIC_OIDC_ISSUER: process.env.GENERIC_OIDC_ISSUER,-- // ZITADEL- ZITADEL_CLIENT_ID: process.env.ZITADEL_CLIENT_ID,- ZITADEL_CLIENT_SECRET: process.env.ZITADEL_CLIENT_SECRET,- ZITADEL_ISSUER: process.env.ZITADEL_ISSUER,-// LOGTO- LOGTO_CLIENT_ID: process.env.LOGTO_CLIENT_ID,- LOGTO_CLIENT_SECRET: process.env.LOGTO_CLIENT_SECRET,- LOGTO_ISSUER: process.env.LOGTO_ISSUER,LOGTO_WEBHOOK_SIGNING_KEY: process.env.LOGTO_WEBHOOK_SIGNING_KEY,// Casdoordiff --git a/src/libs/next-auth/auth.config.ts b/src/libs/next-auth/auth.config.tsindex 88fae046085..8ceef51bdde 100644--- a/src/libs/next-auth/auth.config.ts+++ b/src/libs/next-auth/auth.config.ts@@ -58,7 +58,7 @@ export default {signIn: '/next-auth/signin',},providers: initSSOProviders(),- secret: NEXT_AUTH_SECRET,+ secret: NEXT_AUTH_SECRET ?? process.env.AUTH_SECRET,session: {// Force use JWT if server service is disabledstrategy: NEXT_PUBLIC_ENABLED_SERVER_SERVICE ? NEXT_AUTH_SSO_SESSION_STRATEGY : 'jwt',diff --git a/src/libs/next-auth/sso-providers/auth0.ts b/src/libs/next-auth/sso-providers/auth0.tsindex 8686b9711ec..e9daec4ca64 100644--- a/src/libs/next-auth/sso-providers/auth0.ts+++ b/src/libs/next-auth/sso-providers/auth0.ts@@ -1,7 +1,5 @@import Auth0 from 'next-auth/providers/auth0';-import { authEnv } from '@/envs/auth';-import { CommonProviderConfig } from './sso.config';const provider = {@@ -11,11 +9,6 @@ const provider = {// Specify auth scope, at least include 'openid email'// all scopes in Auth0 ref: https://auth0.com/docs/get-started/apis/scopes/openid-connect-scopes#standard-claimsauthorization: { params: { scope: 'openid email profile' } },- // TODO(NextAuth ENVs Migration): Remove once nextauth envs migration time end- clientId: authEnv.AUTH0_CLIENT_ID ?? process.env.AUTH_AUTH0_ID,- clientSecret: authEnv.AUTH0_CLIENT_SECRET ?? process.env.AUTH_AUTH0_SECRET,- issuer: authEnv.AUTH0_ISSUER ?? process.env.AUTH_AUTH0_ISSUER,- // Remove Endprofile(profile) {return {email: profile.email,diff --git a/src/libs/next-auth/sso-providers/authelia.ts b/src/libs/next-auth/sso-providers/authelia.tsindex 4cf7f2140d9..892b1f1b7ca 100644--- a/src/libs/next-auth/sso-providers/authelia.ts+++ b/src/libs/next-auth/sso-providers/authelia.ts@@ -1,7 +1,5 @@import type { OIDCConfig } from '@auth/core/providers';-import { authEnv } from '@/envs/auth';-import { CommonProviderConfig } from './sso.config';export type AutheliaProfile = {@@ -21,10 +19,10 @@ const provider = {...CommonProviderConfig,authorization: { params: { scope: 'openid email profile' } },checks: ['state', 'pkce'],- clientId: authEnv.AUTHELIA_CLIENT_ID ?? process.env.AUTH_AUTHELIA_ID,- clientSecret: authEnv.AUTHELIA_CLIENT_SECRET ?? process.env.AUTH_AUTHELIA_SECRET,+ clientId: process.env.AUTH_AUTHELIA_ID,+ clientSecret: process.env.AUTH_AUTHELIA_SECRET,id: 'authelia',- issuer: authEnv.AUTHELIA_ISSUER ?? process.env.AUTH_AUTHELIA_ISSUER,+ issuer: process.env.AUTH_AUTHELIA_ISSUER,name: 'Authelia',profile(profile) {return {diff --git a/src/libs/next-auth/sso-providers/authentik.ts b/src/libs/next-auth/sso-providers/authentik.tsindex 1b7c2d42b1d..508ff2ccd86 100644--- a/src/libs/next-auth/sso-providers/authentik.ts+++ b/src/libs/next-auth/sso-providers/authentik.ts@@ -1,7 +1,5 @@import Authentik from 'next-auth/providers/authentik';-import { authEnv } from '@/envs/auth';-import { CommonProviderConfig } from './sso.config';const provider = {@@ -11,11 +9,6 @@ const provider = {// Specify auth scope, at least include 'openid email'// all scopes in Authentik ref: https://goauthentik.io/docs/providers/oauth2authorization: { params: { scope: 'openid email profile' } },- // TODO(NextAuth ENVs Migration): Remove once nextauth envs migration time end- clientId: authEnv.AUTHENTIK_CLIENT_ID ?? process.env.AUTH_AUTHENTIK_ID,- clientSecret: authEnv.AUTHENTIK_CLIENT_SECRET ?? process.env.AUTH_AUTHENTIK_SECRET,- issuer: authEnv.AUTHENTIK_ISSUER ?? process.env.AUTH_AUTHENTIK_ISSUER,- // Remove end// TODO(NextAuth): map unique user id to `providerAccountId` field// profile(profile) {// return {diff --git a/src/libs/next-auth/sso-providers/cloudflare-zero-trust.ts b/src/libs/next-auth/sso-providers/cloudflare-zero-trust.tsindex 1cf1f02103f..4635f9f145e 100644--- a/src/libs/next-auth/sso-providers/cloudflare-zero-trust.ts+++ b/src/libs/next-auth/sso-providers/cloudflare-zero-trust.ts@@ -1,7 +1,5 @@import type { OIDCConfig } from '@auth/core/providers';-import { authEnv } from '@/envs/auth';-import { CommonProviderConfig } from './sso.config';export type CloudflareZeroTrustProfile = {@@ -16,11 +14,10 @@ const provider = {...CommonProviderConfig,authorization: { params: { scope: 'openid email profile' } },checks: ['state', 'pkce'],- clientId: authEnv.CLOUDFLARE_ZERO_TRUST_CLIENT_ID ?? process.env.AUTH_CLOUDFLARE_ZERO_TRUST_ID,- clientSecret:- authEnv.CLOUDFLARE_ZERO_TRUST_CLIENT_SECRET ?? process.env.AUTH_CLOUDFLARE_ZERO_TRUST_SECRET,+ clientId: process.env.AUTH_CLOUDFLARE_ZERO_TRUST_ID,+ clientSecret: process.env.AUTH_CLOUDFLARE_ZERO_TRUST_SECRET,id: 'cloudflare-zero-trust',- issuer: authEnv.CLOUDFLARE_ZERO_TRUST_ISSUER ?? process.env.AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER,+ issuer: process.env.AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER,name: 'Cloudflare Zero Trust',profile(profile) {return {diff --git a/src/libs/next-auth/sso-providers/cognito.ts b/src/libs/next-auth/sso-providers/cognito.tsindex 5aa9ab4d416..b7131976d88 100644--- a/src/libs/next-auth/sso-providers/cognito.ts+++ b/src/libs/next-auth/sso-providers/cognito.ts@@ -2,11 +2,7 @@ import Cognito from 'next-auth/providers/cognito';const provider = {id: 'cognito',- provider: Cognito({- clientId: process.env.AUTH_COGNITO_ID,- clientSecret: process.env.AUTH_COGNITO_SECRET,- issuer: process.env.AUTH_COGNITO_ISSUER,- }),+ provider: Cognito({}),};export default provider;diff --git a/src/libs/next-auth/sso-providers/generic-oidc.ts b/src/libs/next-auth/sso-providers/generic-oidc.tsindex bea74961bbd..1be3cdee9bc 100644--- a/src/libs/next-auth/sso-providers/generic-oidc.ts+++ b/src/libs/next-auth/sso-providers/generic-oidc.ts@@ -1,7 +1,5 @@import type { OIDCConfig } from '@auth/core/providers';-import { authEnv } from '@/envs/auth';-import { CommonProviderConfig } from './sso.config';export type GenericOIDCProfile = {@@ -19,10 +17,10 @@ const provider = {...CommonProviderConfig,authorization: { params: { scope: 'email openid profile' } },checks: ['state', 'pkce'],- clientId: authEnv.GENERIC_OIDC_CLIENT_ID ?? process.env.AUTH_GENERIC_OIDC_ID,- clientSecret: authEnv.GENERIC_OIDC_CLIENT_SECRET ?? process.env.AUTH_GENERIC_OIDC_SECRET,+ clientId: process.env.AUTH_GENERIC_OIDC_ID,+ clientSecret: process.env.AUTH_GENERIC_OIDC_SECRET,id: 'generic-oidc',- issuer: authEnv.GENERIC_OIDC_ISSUER ?? process.env.AUTH_GENERIC_OIDC_ISSUER,+ issuer: process.env.AUTH_GENERIC_OIDC_ISSUER,name: 'Generic OIDC',profile(profile) {return {diff --git a/src/libs/next-auth/sso-providers/github.ts b/src/libs/next-auth/sso-providers/github.tsindex 8209ecadd27..124e1a1e6ed 100644--- a/src/libs/next-auth/sso-providers/github.ts+++ b/src/libs/next-auth/sso-providers/github.ts@@ -1,7 +1,5 @@import GitHub from 'next-auth/providers/github';-import { authEnv } from '@/envs/auth';-import { CommonProviderConfig } from './sso.config';const provider = {@@ -10,10 +8,6 @@ const provider = {...CommonProviderConfig,// Specify auth scope, at least include 'openid email'authorization: { params: { scope: 'read:user user:email' } },- // TODO(NextAuth ENVs Migration): Remove once nextauth envs migration time end- clientId: authEnv.GITHUB_CLIENT_ID ?? process.env.AUTH_GITHUB_ID,- clientSecret: authEnv.GITHUB_CLIENT_SECRET ?? process.env.AUTH_GITHUB_SECRET,- // Remove endprofile: (profile) => {return {email: profile.email,diff --git a/src/libs/next-auth/sso-providers/google.ts b/src/libs/next-auth/sso-providers/google.tsindex 57705853eb1..883424525ac 100644--- a/src/libs/next-auth/sso-providers/google.ts+++ b/src/libs/next-auth/sso-providers/google.ts@@ -12,8 +12,6 @@ const provider = {'openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email openid',},},- clientId: process.env.AUTH_GOOGLE_CLIENT_ID,- clientSecret: process.env.AUTH_GOOGLE_CLIENT_SECRET,}),};diff --git a/src/libs/next-auth/sso-providers/keycloak.ts b/src/libs/next-auth/sso-providers/keycloak.tsindex 74c14d77838..1e52c3d720b 100644--- a/src/libs/next-auth/sso-providers/keycloak.ts+++ b/src/libs/next-auth/sso-providers/keycloak.ts@@ -8,9 +8,6 @@ const provider = {...CommonProviderConfig,// Specify auth scope, at least include 'openid email'authorization: { params: { scope: 'openid email profile' } },- clientId: process.env.AUTH_KEYCLOAK_ID,- clientSecret: process.env.AUTH_KEYCLOAK_SECRET,- issuer: process.env.AUTH_KEYCLOAK_ISSUER,profile(profile) {return {email: profile.email,diff --git a/src/libs/next-auth/sso-providers/logto.ts b/src/libs/next-auth/sso-providers/logto.tsindex 6561415bbea..de0eaf21e0c 100644--- a/src/libs/next-auth/sso-providers/logto.ts+++ b/src/libs/next-auth/sso-providers/logto.ts@@ -1,7 +1,5 @@import { OIDCConfig, OIDCUserConfig } from '@auth/core/providers';-import { authEnv } from '@/envs/auth';-import { CommonProviderConfig } from './sso.config';interface LogtoProfile extends Record<string, any> {@@ -41,9 +39,9 @@ const provider = {},// You can get the issuer value from the Logto Application Details page,// in the field "Issuer endpoint"- clientId: authEnv.LOGTO_CLIENT_ID ?? process.env.AUTH_LOGTO_ID,- clientSecret: authEnv.LOGTO_CLIENT_SECRET ?? process.env.AUTH_LOGTO_SECRET,- issuer: authEnv.LOGTO_ISSUER ?? process.env.AUTH_LOGTO_ISSUER,+ clientId: process.env.AUTH_LOGTO_ID,+ clientSecret: process.env.AUTH_LOGTO_SECRET,+ issuer: process.env.AUTH_LOGTO_ISSUER,}),};diff --git a/src/libs/next-auth/sso-providers/okta.ts b/src/libs/next-auth/sso-providers/okta.tsindex 1934dddfc4d..2050f4c20c7 100644--- a/src/libs/next-auth/sso-providers/okta.ts+++ b/src/libs/next-auth/sso-providers/okta.ts@@ -7,10 +7,6 @@ const provider = {provider: Okta({...CommonProviderConfig,authorization: { params: { scope: 'openid email profile' } },- clientId: process.env.AUTH_OKTA_ID,- clientSecret: process.env.AUTH_OKTA_SECRET,- issuer: process.env.AUTH_OKTA_ISSUER,- // Remove Endprofile(profile) {return {email: profile.email,diff --git a/src/libs/next-auth/sso-providers/zitadel.ts b/src/libs/next-auth/sso-providers/zitadel.tsindex c8f5a79aa29..ffdb3991441 100644--- a/src/libs/next-auth/sso-providers/zitadel.ts+++ b/src/libs/next-auth/sso-providers/zitadel.ts@@ -1,17 +1,10 @@import Zitadel from 'next-auth/providers/zitadel';-import { authEnv } from '@/envs/auth';-const provider = {id: 'zitadel',provider: Zitadel({// Available scopes in ZITADEL: https://zitadel.com/docs/apis/openidoauth/scopesauthorization: { params: { scope: 'openid email profile' } },- // TODO(NextAuth ENVs Migration): Remove once nextauth envs migration time end- clientId: authEnv.ZITADEL_CLIENT_ID ?? process.env.AUTH_ZITADEL_ID,- clientSecret: authEnv.ZITADEL_CLIENT_SECRET ?? process.env.AUTH_ZITADEL_SECRET,- issuer: authEnv.ZITADEL_ISSUER ?? process.env.AUTH_ZITADEL_ISSUER,- // Remove end// TODO(NextAuth): map unique user id to `providerAccountId` field// profile(profile) {// return {