This commit is contained in:
c121914yu
2025-04-21 08:21:17 +00:00
parent 80443e520c
commit fb078075f2
8 changed files with 272 additions and 253 deletions

View File

@@ -131,41 +131,57 @@ Table of Contents</button><nav id=toc-mobile><ul class=dropdown-menu><li><ul><li
- WECOM_APP_SECRET=
# 通讯录同步助手的 Secret
- WECOM_SYNC_SECRET=</code>
</pre></div><h3 id=标准-oauth20>标准 OAuth2.0 <a href=#%e6%a0%87%e5%87%86-oauth20 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><h4 id=参数需求>参数需求 <a href=#%e5%8f%82%e6%95%b0%e9%9c%80%e6%b1%82 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h4><p>我们提供一套标准的 OAuth2.0 接入流程。需要三个地址:</p><ol><li>登陆鉴权地址(登陆后将 code 传入 redirect_uri<ul><li>需要将地址完整写好,除了 redirect_uri 以外(会自动补全)</li></ul></li><li>获取 access_token 的地址,请求为 GET 方法,参数 code</li></ol><div class=prism-codeblock><pre id=6691496 class=language-bash>
<code>http://example.com/oauth/access_token?code=xxxx</code>
</pre></div><ol start=3><li>获取用户信息的地址</li></ol><div class=prism-codeblock><pre id=04dfd88 class=language-bash>
<code>http://example.com/oauth/user_info</code>
</pre></div><h4 id=配置示例>配置示例 <a href=#%e9%85%8d%e7%bd%ae%e7%a4%ba%e4%be%8b class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h4><div class=prism-codeblock><pre id=be4f11b class=language-bash>
</pre></div><h3 id=标准-oauth20>标准 OAuth2.0 <a href=#%e6%a0%87%e5%87%86-oauth20 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p>我们提供一套 RFC 6749 中鉴权码模式的 OAuth2.0 接入支持。
参考:</p><ul><li><a href=https://datatracker.ietf.org/doc/html/rfc6749 rel=external target=_blank>RFC 6749<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a> 文档。</li><li><a href=https://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html rel=external target=_blank>阮一峰的网络日志<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a></li></ul><h4 id=参数需求>参数需求 <a href=#%e5%8f%82%e6%95%b0%e9%9c%80%e6%b1%82 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h4><h5 id=三个地址>三个地址 <a href=#%e4%b8%89%e4%b8%aa%e5%9c%b0%e5%9d%80 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h5><p>我们提供一套标准的 OAuth2.0 接入流程。需要三个地址:</p><ol><li>登陆鉴权地址(用户点击 SSO 按钮后将携带参数直接跳转到该地址), 例如:<code>http://example.com/oauth/authorize</code><div class=prism-codeblock><pre id=e411ea9 class=language-bash>
<code>curl -X GET\
&#34;http://example.com/oauth/authorize?response_type=code&amp;client_id=s6BhdRkqt3&amp;state=xyz&amp;redirect_uri=https%3A%2F%2Ffastgpt.cn%2Flogin%2Fprovider&#34;</code>
</pre></div>用户输入账号密码后,会跳转到 redirect_uri 中,并携带 code 参数:
<code>https://fastgpt.cn/login/provider?code=4/P7qD2qAz4&amp;state=xyz</code></li><li>获取 access_token 的地址,获取到 code 后,通过<em>服务器请求</em>该地址获取 access_token 例如:<code>http://example.com/oauth/access_token</code><div class=prism-codeblock><pre id=b8fa479 class=language-bash>
<code>curl -X POST\
-H &#34;Content-Type: application/x-www-form-urlencoded&#34;\
&#34;http://example.com/oauth/access_token?grant_type=authorization_code&amp;client_id=s6BhdRkqt3&amp;client_secret=xxx&amp;code=4/P7qD2qAz4&amp;redirect_uri=https%3A%2F%2Ffastgpt.cn%2Flogin%2Fprovider&#34;</code>
</pre></div>注意Content-Type 必须是 application/x-www-form-urlencoded, 而不是 application/json</li><li>获取用户信息的地址,需要传入 access_token 例如:<code>http://example.com/oauth/user_info</code><div class=prism-codeblock><pre id=934168a class=language-bash>
<code>curl -X GET\
-H &#34;Authorization: Bearer 4/P7qD2qAz4&#34;\
&#34;http://example.com/oauth/user_info&#34;</code>
</pre></div>注意: access_token 作为 Authorization 头部传入, 格式为 Bearer xxxx</li></ol><h5 id=参数配置>参数配置 <a href=#%e5%8f%82%e6%95%b0%e9%85%8d%e7%bd%ae class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h5><ul><li>CLIENT_ID: 必须</li><li>CLIENT_SECRET: 非必须,如果没有可以不配置</li><li>SCOPE: 非必须,如果没有可以不配置</li></ul><blockquote><p>redirect_uri 参数会根据运行环境自动补全</p><p>其他固定参数如 grant_type, response_type 等会自动补全</p></blockquote><h4 id=配置示例>配置示例 <a href=#%e9%85%8d%e7%bd%ae%e7%a4%ba%e4%be%8b class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h4><div class=prism-codeblock><pre id=840bc0b class=language-bash>
<code>fastgpt-sso:
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0
container_name: fastgpt-sso
restart: always
networks:
- fastgpt
environment:
# OAuth2.0
- AUTH_TOKEN=xxxxx
- SSO_PROVIDER=oauth2
# OAuth2 重定向地址
- OAUTH2_AUTHORIZE_URL=
# OAuth2 获取 AccessToken 地址
- OAUTH2_TOKEN_URL=
# OAuth2 获取用户信息地址
- OAUTH2_USER_INFO_URL=
# OAuth2 用户名字段映射(必填)
- OAUTH2_USERNAME_MAP=
# OAuth2 头像字段映射(选填)
- OAUTH2_AVATAR_MAP=
# OAuth2 成员名字段映射(选填)
- OAUTH2_MEMBER_NAME_MAP=
# OAuth2 联系方式字段映射(选填)
- OAUTH2_CONTACT_MAP=</code>
</pre></div><h2 id=标准接口文档>标准接口文档 <a href=#%e6%a0%87%e5%87%86%e6%8e%a5%e5%8f%a3%e6%96%87%e6%a1%a3 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h2><p>以下是 FastGPT-pro 中SSO 和成员同步的标准接口文档,如果需要对接非标准系统,可以参考该章节进行开发。</p><p><img src=https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/sso18.png alt loading=lazy class=medium-zoom-image></p><p>FastGPT 提供如下标准接口支持:</p><ol><li><a href=https://example.com/login/oauth/getAuthURL rel=external target=_blank>https://example.com/login/oauth/getAuthURL<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a> 获取鉴权重定向地址</li><li><a href="https://example.com/login/oauth/getUserInfo?code=xxxxx" rel=external target=_blank>https://example.com/login/oauth/getUserInfo?code=xxxxx<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a> 消费 code换取用户信息</li><li><a href=https://example.com/org/list rel=external target=_blank>https://example.com/org/list<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a> 获取组织列表</li><li><a href=https://example.com/user/list rel=external target=_blank>https://example.com/user/list<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a> 获取成员列表</li></ol><h3 id=获取-sso-登录重定向地址>获取 SSO 登录重定向地址 <a href=#%e8%8e%b7%e5%8f%96-sso-%e7%99%bb%e5%bd%95%e9%87%8d%e5%ae%9a%e5%90%91%e5%9c%b0%e5%9d%80 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p>返回一个重定向登录地址fastgpt 会自动重定向到该地址。redirect_uri 会自动拼接到该地址的 query中。</p><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=ecdfabTab data-bs-toggle=tab data-bs-target=#ecdfab type=button role=tab aria-controls=ecdfab aria-selected=true>请求示例</a>
<a class=nav-link id=efcbadTab data-bs-toggle=tab data-bs-target=#efcbad type=button role=tab aria-controls=efcbad aria-selected=true>响应示例</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=ecdfab role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=3970eeb class=language-bash>
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sso-service:v4.9.0
container_name: fastgpt-sso
restart: always
networks:
- fastgpt
environment:
# OAuth2.0
# === 请求地址 ===
# 1. OAuth2 登陆鉴权地址 (必填)
- OAUTH2_AUTHORIZE_URL=
# 2. OAuth2 获取 AccessToken 地址 (必填)
- OAUTH2_TOKEN_URL=
# 3. OAuth2 获取用户信息地址 (必填)
- OAUTH2_USER_INFO_URL=
# === 参数 ===
# 1. client_id (必填)
- OAUTH2_CLIENT_ID=
# 2. client_secret (选填,如果没有则不传)
- OAUTH2_CLIENT_SECRET=
# 3. scope 选填
- OAUTH2_SCOPE=
# === 字段映射 ===
# OAuth2 用户名字段映射(必填)
- OAUTH2_USERNAME_MAP=
# OAuth2 头像字段映射(选填)
- OAUTH2_AVATAR_MAP=
# OAuth2 成员名字段映射(选填)
- OAUTH2_MEMBER_NAME_MAP=
# OAuth2 联系方式字段映射(选填)
- OAUTH2_CONTACT_MAP=</code>
</pre></div><h2 id=标准接口文档>标准接口文档 <a href=#%e6%a0%87%e5%87%86%e6%8e%a5%e5%8f%a3%e6%96%87%e6%a1%a3 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h2><p>以下是 FastGPT-pro 中SSO 和成员同步的标准接口文档,如果需要对接非标准系统,可以参考该章节进行开发。</p><p><img src=https://cdn.jsdelivr.net/gh/yangchuansheng/fastgpt-imgs@main/imgs/sso18.png alt loading=lazy class=medium-zoom-image></p><p>FastGPT 提供如下标准接口支持:</p><ol><li><a href=https://example.com/login/oauth/getAuthURL rel=external target=_blank>https://example.com/login/oauth/getAuthURL<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a> 获取鉴权重定向地址</li><li><a href="https://example.com/login/oauth/getUserInfo?code=xxxxx" rel=external target=_blank>https://example.com/login/oauth/getUserInfo?code=xxxxx<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a> 消费 code换取用户信息</li><li><a href=https://example.com/org/list rel=external target=_blank>https://example.com/org/list<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a> 获取组织列表</li><li><a href=https://example.com/user/list rel=external target=_blank>https://example.com/user/list<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a> 获取成员列表</li></ol><h3 id=获取-sso-登录重定向地址>获取 SSO 登录重定向地址 <a href=#%e8%8e%b7%e5%8f%96-sso-%e7%99%bb%e5%bd%95%e9%87%8d%e5%ae%9a%e5%90%91%e5%9c%b0%e5%9d%80 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p>返回一个重定向登录地址fastgpt 会自动重定向到该地址。redirect_uri 会自动拼接到该地址的 query中。</p><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=dcbfeaTab data-bs-toggle=tab data-bs-target=#dcbfea type=button role=tab aria-controls=dcbfea aria-selected=true>请求示例</a>
<a class=nav-link id=afdecbTab data-bs-toggle=tab data-bs-target=#afdecb type=button role=tab aria-controls=afdecb aria-selected=true>响应示例</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=dcbfea role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=3970eeb class=language-bash>
<code>curl -X GET &#34;https://redict.example/login/oauth/getAuthURL?redirect_uri=xxx&amp;state=xxxx&#34; \
-H &#34;Authorization: Bearer your_token_here&#34; \
-H &#34;Content-Type: application/json&#34;</code>
</pre></div></div><div class="tab-pane fade" id=efcbad role=tabpanel aria-labelledby=nav-1><p>成功:</p><div class=prism-codeblock><pre id=8296736 class=language-JSON>
</pre></div></div><div class="tab-pane fade" id=afdecb role=tabpanel aria-labelledby=nav-1><p>成功:</p><div class=prism-codeblock><pre id=8296736 class=language-JSON>
<code>{
&#34;success&#34;: true,
&#34;message&#34;: &#34;&#34;,
@@ -177,12 +193,12 @@ Table of Contents</button><nav id=toc-mobile><ul class=dropdown-menu><li><ul><li
&#34;message&#34;: &#34;错误信息&#34;,
&#34;authURL&#34;: &#34;&#34;
}</code>
</pre></div></div></div><h3 id=sso-获取用户信息>SSO 获取用户信息 <a href=#sso-%e8%8e%b7%e5%8f%96%e7%94%a8%e6%88%b7%e4%bf%a1%e6%81%af class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p>该接口接受一个 code 参数作为鉴权,消费 code 返回用户信息。</p><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=edafbcTab data-bs-toggle=tab data-bs-target=#edafbc type=button role=tab aria-controls=edafbc aria-selected=true>请求示例</a>
<a class=nav-link id=fecbadTab data-bs-toggle=tab data-bs-target=#fecbad type=button role=tab aria-controls=fecbad aria-selected=true>响应示例</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=edafbc role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=532f1a3 class=language-bash>
</pre></div></div></div><h3 id=sso-获取用户信息>SSO 获取用户信息 <a href=#sso-%e8%8e%b7%e5%8f%96%e7%94%a8%e6%88%b7%e4%bf%a1%e6%81%af class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><p>该接口接受一个 code 参数作为鉴权,消费 code 返回用户信息。</p><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=fbeadcTab data-bs-toggle=tab data-bs-target=#fbeadc type=button role=tab aria-controls=fbeadc aria-selected=true>请求示例</a>
<a class=nav-link id=ecafdbTab data-bs-toggle=tab data-bs-target=#ecafdb type=button role=tab aria-controls=ecafdb aria-selected=true>响应示例</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=fbeadc role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=532f1a3 class=language-bash>
<code>curl -X GET &#34;https://oauth.example/login/oauth/getUserInfo?code=xxxxxx&#34; \
-H &#34;Authorization: Bearer your_token_here&#34; \
-H &#34;Content-Type: application/json&#34;</code>
</pre></div></div><div class="tab-pane fade" id=fecbad role=tabpanel aria-labelledby=nav-1><p>成功:</p><div class=prism-codeblock><pre id=71afe34 class=language-JSON>
</pre></div></div><div class="tab-pane fade" id=ecafdb role=tabpanel aria-labelledby=nav-1><p>成功:</p><div class=prism-codeblock><pre id=71afe34 class=language-JSON>
<code>{
&#34;success&#34;: true,
&#34;message&#34;: &#34;&#34;,
@@ -199,16 +215,16 @@ Table of Contents</button><nav id=toc-mobile><ul class=dropdown-menu><li><ul><li
&#34;avatar&#34;: &#34;&#34;,
&#34;contact&#34;: &#34;&#34;
}</code>
</pre></div></div></div><h3 id=获取组织>获取组织 <a href=#%e8%8e%b7%e5%8f%96%e7%bb%84%e7%bb%87 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=afdcbeTab data-bs-toggle=tab data-bs-target=#afdcbe type=button role=tab aria-controls=afdcbe aria-selected=true>请求示例</a>
<a class=nav-link id=feacbdTab data-bs-toggle=tab data-bs-target=#feacbd type=button role=tab aria-controls=feacbd aria-selected=true>响应示例</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=afdcbe role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=d289d9a class=language-bash>
</pre></div></div></div><h3 id=获取组织>获取组织 <a href=#%e8%8e%b7%e5%8f%96%e7%bb%84%e7%bb%87 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=cebfdaTab data-bs-toggle=tab data-bs-target=#cebfda type=button role=tab aria-controls=cebfda aria-selected=true>请求示例</a>
<a class=nav-link id=adfcebTab data-bs-toggle=tab data-bs-target=#adfceb type=button role=tab aria-controls=adfceb aria-selected=true>响应示例</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=cebfda role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=d289d9a class=language-bash>
<code>curl -X GET &#34;https://example.com/org/list&#34; \
-H &#34;Authorization: Bearer your_token_here&#34; \
-H &#34;Content-Type: application/json&#34;</code>
</pre></div></div><div class="tab-pane fade" id=feacbd role=tabpanel aria-labelledby=nav-1><p>⚠️注意:只能存在一个根部门。如果你的系统中存在多个根部门,需要先进行处理,加一个虚拟的根部门。返回值类型:</p><div class=prism-codeblock><pre id=5634349 class=language-ts>
</pre></div></div><div class="tab-pane fade" id=adfceb role=tabpanel aria-labelledby=nav-1><p>⚠️注意:只能存在一个根部门。如果你的系统中存在多个根部门,需要先进行处理,加一个虚拟的根部门。返回值类型:</p><div class=prism-codeblock><pre id=1224f6e class=language-ts>
<code>type OrgListResponseType = {
message?: string; // 报错信息
success: boolean;
orgList: {
orgList: {
id: string; // 部门的唯一 id
name: string; // 名字
parentId: string; // parentId如果为根部门传空字符串。
@@ -231,17 +247,17 @@ Table of Contents</button><nav id=toc-mobile><ul class=dropdown-menu><li><ul><li
}
]
}</code>
</pre></div></div></div><h3 id=获取成员>获取成员 <a href=#%e8%8e%b7%e5%8f%96%e6%88%90%e5%91%98 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=beadfcTab data-bs-toggle=tab data-bs-target=#beadfc type=button role=tab aria-controls=beadfc aria-selected=true>请求示例</a>
<a class=nav-link id=fdeacbTab data-bs-toggle=tab data-bs-target=#fdeacb type=button role=tab aria-controls=fdeacb aria-selected=true>响应示例</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=beadfc role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=bc9e9ec class=language-bash>
</pre></div></div></div><h3 id=获取成员>获取成员 <a href=#%e8%8e%b7%e5%8f%96%e6%88%90%e5%91%98 class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h3><nav><div class="nav nav-tabs" id=nav-tab role=tablist><a class="nav-link active" id=bcefadTab data-bs-toggle=tab data-bs-target=#bcefad type=button role=tab aria-controls=bcefad aria-selected=true>请求示例</a>
<a class=nav-link id=cadfebTab data-bs-toggle=tab data-bs-target=#cadfeb type=button role=tab aria-controls=cadfeb aria-selected=true>响应示例</a></div></nav><div class=tab-content id=nav-tab-content><div class="tab-pane fade show active" id=bcefad role=tabpanel aria-labelledby=nav-1><div class=prism-codeblock><pre id=bc9e9ec class=language-bash>
<code>curl -X GET &#34;https://example.com/user/list&#34; \
-H &#34;Authorization: Bearer your_token_here&#34; \
-H &#34;Content-Type: application/json&#34;</code>
</pre></div></div><div class="tab-pane fade" id=fdeacb role=tabpanel aria-labelledby=nav-1><p>返回值类型:</p><div class=prism-codeblock><pre id=3f6bc41 class=language-typescript>
</pre></div></div><div class="tab-pane fade" id=cadfeb role=tabpanel aria-labelledby=nav-1><p>返回值类型:</p><div class=prism-codeblock><pre id=0315dd3 class=language-typescript>
<code>type UserListResponseListType = {
message?: string; // 报错信息
success: boolean;
userList: {
username: string; // 唯一 id username 必须与 SSO 接口返回的用户 username 相同。并且必须携带一个前缀,例如: sync-aaaaa和 sso 接口返回的前缀一致
username: string; // 唯一 id username 必须与 SSO 接口返回的用户 username 相同。并且必须携带一个前缀,例如: sync-aaaaa和 sso 接口返回的前缀一致
memberName?: string; // 名字,作为 tmbname
avatar?: string;
contact?: string; // email or phone number
@@ -270,7 +286,10 @@ Table of Contents</button><nav id=toc-mobile><ul class=dropdown-menu><li><ul><li
]
}</code>
</pre></div></div></div><h2 id=如何对接非标准系统>如何对接非标准系统 <a href=#%e5%a6%82%e4%bd%95%e5%af%b9%e6%8e%a5%e9%9d%9e%e6%a0%87%e5%87%86%e7%b3%bb%e7%bb%9f class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h2><ol><li>客户自己开发:按 fastgpt 提供的标准接口进行开发,并将部署后的服务地址填入 fastgpt-pro<br>可以参考该模版库:<a href=https://github.com/labring/fastgpt-sso-template rel=external target=_blank>fastgpt-sso-template<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a> 进行开发</li><li>由 fastgpt 团队定制开发:<br>a. 提供系统的 SSO 文档、获取成员和组织的文档、以及外网测试地址。<br>b. 在 fastgpt-sso-service 中,增加对应的 provider 和环境变量,并编写代码来对接。</li></ol></div><div class="gitinfo d-flex flex-wrap justify-content-between align-items-center opacity-85 pt-3"><div id=edit-this-page class=mt-1><a href=https://github.com/labring/FastGPT/blob/main/docSite/content/zh-cn/docs/guide/admin/sso.md alt="SSO & 外部成员同步" rel="noopener noreferrer" target=_blank><span class="me-1 align-text-bottom"><svg width="20" height="20" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" fill="currentcolor"><path d="M16 .396c-8.839.0-16 7.167-16 16 0 7.073 4.584 13.068 10.937 15.183.803.151 1.093-.344 1.093-.772.0-.38-.009-1.385-.015-2.719-4.453.964-5.391-2.151-5.391-2.151-.729-1.844-1.781-2.339-1.781-2.339-1.448-.989.115-.968.115-.968 1.604.109 2.448 1.645 2.448 1.645 1.427 2.448 3.744 1.74 4.661 1.328.14-1.031.557-1.74 1.011-2.135-3.552-.401-7.287-1.776-7.287-7.907.0-1.751.62-3.177 1.645-4.297-.177-.401-.719-2.031.141-4.235.0.0 1.339-.427 4.4 1.641 1.281-.355 2.641-.532 4-.541 1.36.009 2.719.187 4 .541 3.043-2.068 4.381-1.641 4.381-1.641.859 2.204.317 3.833.161 4.235 1.015 1.12 1.635 2.547 1.635 4.297.0 6.145-3.74 7.5-7.296 7.891.556.479 1.077 1.464 1.077 2.959.0 2.14-.02 3.864-.02 4.385.0.416.28.916 1.104.755 6.4-2.093 10.979-8.093 10.979-15.156.0-8.833-7.161-16-16-16z"/></svg></span>编辑此页面</a></div></div></div><div><hr class=doc-hr><div id=doc-nav class=d-print-none><div class="row flex-xl-nowrap"><div class="col-sm-6 pt-2 doc-next"><a href=/docs/development/docker/><div class="card h-100 my-1"><div class="card-body py-2"><p class="card-title fs-5 fw-semibold lh-base mb-0"><i class="material-icons align-middle">navigate_before</i> Docker Compose 快速部署</p><p class="card-text ms-2">使用 Docker Compose 快速部署 FastGPT</p></div></div></a></div><div class="col-sm-6 pt-2 doc-prev"><a class=ms-auto href=/docs/development/configuration/><div class="card h-100 my-1 text-end"><div class="card-body py-2"><p class="card-title fs-5 fw-semibold lh-base mb-0">配置文件介绍 <i class="material-icons align-middle">navigate_next</i></p><p class="card-text me-2">FastGPT 配置参数介绍</p></div></div></a></div></div></div></div></div></div></div></div><footer class="shadow py-3 d-print-none"><div class="row align-items-center" style=height:90px><div class=col><div class="text-sm-start text-center mx-md-2"><p class=mb-0>© 2025 the FastGPT Authors.</p><p class=github-badge><span class=badge-subject>云操作系统</span><span class="badge-value bg-blue"><a style=color:#fff href=https://sealos.io/ target=_blank>Sealos</a></span>
</pre></div></div></div><h2 id=如何对接非标准系统>如何对接非标准系统 <a href=#%e5%a6%82%e4%bd%95%e5%af%b9%e6%8e%a5%e9%9d%9e%e6%a0%87%e5%87%86%e7%b3%bb%e7%bb%9f class=anchor aria-hidden=true><i class="material-icons align-middle">link</i></a></h2><ol><li>客户自己开发:按 fastgpt 提供的标准接口进行开发,并将部署后的服务地址填入 fastgpt-pro
可以参考该模版库:<a href=https://github.com/labring/fastgpt-sso-template rel=external target=_blank>fastgpt-sso-template<svg width="16" height="16" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentcolor" d="M14 5c-.552.0-1-.448-1-1s.448-1 1-1h6c.552.0 1 .448 1 1v6c0 .552-.448 1-1 1s-1-.448-1-1V6.414l-7.293 7.293c-.391.39-1.024.39-1.414.0-.391-.391-.391-1.024.0-1.414L17.586 5H14zM5 7c-.552.0-1 .448-1 1v11c0 .552.448 1 1 1h11c.552.0 1-.448 1-1v-4.563c0-.552.448-1 1-1s1 .448 1 1V19c0 1.657-1.343 3-3 3H5c-1.657.0-3-1.343-3-3V8c0-1.657 1.343-3 3-3h4.563c.552.0 1 .448 1 1s-.448 1-1 1H5z"/></svg></a> 进行开发</li><li>由 fastgpt 团队定制开发:
a. 提供系统的 SSO 文档、获取成员和组织的文档、以及外网测试地址。
b. 在 fastgpt-sso-service 中,增加对应的 provider 和环境变量,并编写代码来对接。</li></ol></div><div class="gitinfo d-flex flex-wrap justify-content-between align-items-center opacity-85 pt-3"><div id=edit-this-page class=mt-1><a href=https://github.com/labring/FastGPT/blob/main/docSite/content/zh-cn/docs/guide/admin/sso.md alt="SSO & 外部成员同步" rel="noopener noreferrer" target=_blank><span class="me-1 align-text-bottom"><svg width="20" height="20" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" fill="currentcolor"><path d="M16 .396c-8.839.0-16 7.167-16 16 0 7.073 4.584 13.068 10.937 15.183.803.151 1.093-.344 1.093-.772.0-.38-.009-1.385-.015-2.719-4.453.964-5.391-2.151-5.391-2.151-.729-1.844-1.781-2.339-1.781-2.339-1.448-.989.115-.968.115-.968 1.604.109 2.448 1.645 2.448 1.645 1.427 2.448 3.744 1.74 4.661 1.328.14-1.031.557-1.74 1.011-2.135-3.552-.401-7.287-1.776-7.287-7.907.0-1.751.62-3.177 1.645-4.297-.177-.401-.719-2.031.141-4.235.0.0 1.339-.427 4.4 1.641 1.281-.355 2.641-.532 4-.541 1.36.009 2.719.187 4 .541 3.043-2.068 4.381-1.641 4.381-1.641.859 2.204.317 3.833.161 4.235 1.015 1.12 1.635 2.547 1.635 4.297.0 6.145-3.74 7.5-7.296 7.891.556.479 1.077 1.464 1.077 2.959.0 2.14-.02 3.864-.02 4.385.0.416.28.916 1.104.755 6.4-2.093 10.979-8.093 10.979-15.156.0-8.833-7.161-16-16-16z"/></svg></span>编辑此页面</a></div></div></div><div><hr class=doc-hr><div id=doc-nav class=d-print-none><div class="row flex-xl-nowrap"><div class="col-sm-6 pt-2 doc-next"><a href=/docs/development/docker/><div class="card h-100 my-1"><div class="card-body py-2"><p class="card-title fs-5 fw-semibold lh-base mb-0"><i class="material-icons align-middle">navigate_before</i> Docker Compose 快速部署</p><p class="card-text ms-2">使用 Docker Compose 快速部署 FastGPT</p></div></div></a></div><div class="col-sm-6 pt-2 doc-prev"><a class=ms-auto href=/docs/development/configuration/><div class="card h-100 my-1 text-end"><div class="card-body py-2"><p class="card-title fs-5 fw-semibold lh-base mb-0">配置文件介绍 <i class="material-icons align-middle">navigate_next</i></p><p class="card-text me-2">FastGPT 配置参数介绍</p></div></div></a></div></div></div></div></div></div></div></div><footer class="shadow py-3 d-print-none"><div class="row align-items-center" style=height:90px><div class=col><div class="text-sm-start text-center mx-md-2"><p class=mb-0>© 2025 the FastGPT Authors.</p><p class=github-badge><span class=badge-subject>云操作系统</span><span class="badge-value bg-blue"><a style=color:#fff href=https://sealos.io/ target=_blank>Sealos</a></span>
<span class=badge-subject>云开发</span><span class="badge-value bg-brightgreen"><a style=color:#fff href=https://laf.run target=_blank>Laf</a></span>
<span class=badge-subject>云原生存储</span><span class="badge-value bg-orange"><a style=color:#fff href=https://github.com/labring/sealfs target=_blank>Sealfs</a></span></p><div id=fixed-box><div class=feedback-btn-wrapper><a href=https://fael3z0zfze.feishu.cn/share/base/form/shrcnRxj3utrzjywsom96Px4sud style=text-decoration:none target=_blank><button id=feedback-btn title="Give feedback"><svg class="inline w-5 h-5" viewBox="0 0 20 20" fill="currentcolor"><path fill-rule="evenodd" d="M18 13V5a2 2 0 00-2-2H4A2 2 0 002 5v8a2 2 0 002 2h3l3 3 3-3h3a2 2 0 002-2zM5 7a1 1 0 011-1h8a1 1 0 110 2H6A1 1 0 015 7zm1 3a1 1 0 100 2h3a1 1 0 100-2H6z" clip-rule="evenodd"/></svg>
<span _msttexthash=6039839 _msthash=295>咨询合作</span></button></a></div></div></div></div></div></footer></main></div></div><button onclick=topFunction() id=back-to-top aria-label="Back to Top Button" class="back-to-top fs-5"><svg width="24" height="24"><path d="M12 10.224l-6.3 6.3-1.38-1.372L12 7.472l7.68 7.68-1.38 1.376z" style="fill:#fff"/></svg></button>