-
Notifications
You must be signed in to change notification settings - Fork 7
docs:添加OAuth功能的文档 #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ export default defineConfig({ | |
| postChat({ | ||
| // 账户设置 | ||
| key: 'P-915FBDZX7U944XJF', // 可以到 https://ai.tianli0.top/ 获取账户KEY | ||
|
|
||
| // 文章摘要设置 | ||
| enableSummary: false, // 是否启用文章摘要 | ||
| postSelector: '#VPContent .container > .content', // 文章选择器 | ||
|
|
@@ -31,18 +31,18 @@ export default defineConfig({ | |
| bottom: "16px", // 按钮底部位置 | ||
| left: "16px", // 按钮左侧位置 | ||
| width: "44px", // 按钮宽度 | ||
|
|
||
| // 功能配置 | ||
| defaultInput: false, // 自动填充当前页面标题 | ||
| upLoadWeb: true, // 上传网站到知识库 | ||
| showInviteLink: true, // 显示邀请链接 | ||
| addButton: true, // 是否显示悬浮按钮 | ||
|
|
||
| // 界面配置 | ||
| userTitle: "智能助手", // 用户标题 | ||
| userDesc: "如果你对部署的内容有任何疑问,可以来问我哦~", // 用户描述 | ||
| userIcon: "", // 自定义界面图标URL | ||
|
|
||
| // 预设问题配置 | ||
| defaultChatQuestions: [ | ||
| "如何部署这个项目?", | ||
|
|
@@ -107,6 +107,7 @@ export default defineConfig({ | |
| { text: "接入说说", link: "/exts/talks" }, | ||
| { text: "自定字段", link: "/exts/custom" }, | ||
| { text: "访客统计", link: "/exts/statistic" }, | ||
| {text:"OAuth2/OIDC 登录",link:"/exts/oauth2"} | ||
| ], | ||
| }, | ||
| { | ||
|
|
@@ -172,6 +173,7 @@ export default defineConfig({ | |
| { text: "Qexo Talks", link: "/en/exts/talks" }, | ||
| { text: "Custom Fields", link: "/en/exts/custom" }, | ||
| { text: "PV Statistic", link: "/en/exts/statistic" }, | ||
| {text:"OAuth2/OIDC Login",link:"/en/exts/oauth2"} | ||
|
||
| ], | ||
| }, | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,123 @@ | ||||||
| # OAuth2/OIDC Login | ||||||
|
|
||||||
| This tutorial will help you integrate OAuth2/OIDC login functionality into Qexo in minutes. | ||||||
|
|
||||||
| ## Important Notes | ||||||
|
|
||||||
| 1. OAuth2/OIDC functionality requires Qexo >= 4.0.0 and a modern browser. | ||||||
|
|
||||||
| 2. Before using this tutorial, you need to prepare the identity provider integration information. | ||||||
|
|
||||||
| ## Adding an Identity Provider | ||||||
|
|
||||||
| Please copy the following configuration template to your local text editor and configure it according to the specific | ||||||
| provider type. | ||||||
|
|
||||||
| ```json | ||||||
|
|
||||||
| { | ||||||
| "oidc_provider": { | ||||||
| "type": "oidc", | ||||||
| "info": { | ||||||
| "server_metadata_url": "https://example.com/.well-known/openid-configuration", | ||||||
| "client_id": "YOUR_CLIENT_ID", | ||||||
| "client_secret": "YOUR_CLIENT_SECRET", | ||||||
| "client_kwargs": { | ||||||
| "scope": "openid profile" | ||||||
| } | ||||||
| }, | ||||||
| "friendly_name": "Display Name", | ||||||
| "icon": "https://example.com/icon.png" | ||||||
| }, | ||||||
| "github": { | ||||||
| "type": "github", | ||||||
| "info": { | ||||||
| "client_id": "YOUR_CLIENT_ID", | ||||||
| "client_secret": "YOUR_CLIENT_SECRET", | ||||||
| "client_kwargs": { | ||||||
| "scope": "" | ||||||
| } | ||||||
| }, | ||||||
| "friendly_name": "GitHub", | ||||||
| "icon": "https://example.com/github-icon.png" | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| This template provides two different types of provider examples | ||||||
|
|
||||||
| ### Providers that support the OIDC specification, such as Google, Authentik | ||||||
|
|
||||||
| 1. Rename `oidc_provider` to your own provider name. This name will not be displayed on the page; it should be a short | ||||||
| English word. | ||||||
|
|
||||||
| <h4>Note that in the configuration file, the provider name (i.e., the content at the `oidc_provider` location) must be | ||||||
| unique.</h4> | ||||||
|
Comment on lines
+54
to
+55
|
||||||
|
|
||||||
| 2. Based on your provider configuration, modify `server_metadata_url`, `client_id`, and `client_secret`. | ||||||
|
|
||||||
| 3. Modify `friendly_name` and `icon`, which will determine how the provider is displayed on the front end. | ||||||
|
|
||||||
| 4. If you don't need them, remove the unnecessary `github` field from the configuration file. | ||||||
|
|
||||||
| 5. On your provider's end, set the callback URL to | ||||||
| `https://<your Qexo address>/api/oauth/callback/<the provider name you set in step 1>`. | ||||||
|
|
||||||
| <h4>About OpenID Scopes:</h4> | ||||||
|
|
||||||
| Qexo only requires two scopes: openid and profile. You can add other scopes, but they won't work by default. | ||||||
|
|
||||||
| ### Providers that do not support the OIDC specification, such as GitHub | ||||||
|
|
||||||
| <h4>For providers that do not support the OIDC specification, Qexo currently only supports GitHub. You can modify the | ||||||
| code yourself if needed.</h4> | ||||||
|
|
||||||
| 1. Obtain `client_id` and `client_secret` from GitHub and fill them into the configuration file. | ||||||
|
|
||||||
| 2. Configure the icon to point to the GitHub logo. URL | ||||||
|
||||||
| 2. Configure the icon to point to the GitHub logo. URL | |
| 2. Configure the icon field to use a URL that points to a GitHub logo image. |
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar/readability: “username+password login passkey login” is missing a conjunction and is hard to parse. Rephrase to clearly list the disabled login methods (e.g., username/password and passkey).
| <h4>Note: Enabling this feature will disable Qexo's default username+password login passkey login, allowing only | |
| <h4>Note: Enabling this feature will disable Qexo's default username/password and passkey logins, allowing only |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,96 @@ | ||||||
| # OAuth2/OIDC 登录 | ||||||
|
|
||||||
| 这个教程将帮助你在几分钟内为 Qexo 接入 OAuth2/OIDC 登录功能 | ||||||
|
|
||||||
| ## 须知 | ||||||
|
|
||||||
| 1. Auth2/OIDC 功能要求 Qexo >= 4.0.0,且使用现代浏览器 | ||||||
|
||||||
| 1. Auth2/OIDC 功能要求 Qexo >= 4.0.0,且使用现代浏览器 | |
| 1. OAuth2/OIDC 功能要求 Qexo >= 4.0.0,且使用现代浏览器 |
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using raw HTML <h4> tags for emphasis/headings is inconsistent with the rest of the docs and may render/stylize unexpectedly across themes. Prefer Markdown (e.g., #### ... or bold "Note:") for these callouts (and apply the same change to the other <h4> blocks in this doc).
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“GitHub 微标” looks like a typo; in Chinese documentation the common term is “徽标/图标”.
| 2. 将 icon 配置为一个指向 GitHub 微标的 URL | |
| 2. 将 icon 配置为一个指向 GitHub 徽标的 URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code style inconsistency: this sidebar item doesn’t match the prevailing
{ text: "...", link: "..." },formatting used throughout this config. Please align spacing (and add a trailing comma if that’s the file’s style) to keep the config consistent and avoid formatter churn.