From 45b51ea0ee56a72d757dafefa92af7f421c943ec Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 20 Dec 2024 23:27:00 +0800 Subject: [PATCH] feat: update feishu oauth login --- README.md | 4 ++-- controller/auth/lark.go | 2 +- web/berry/src/utils/common.js | 2 +- web/build.sh | 0 4 files changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 web/build.sh diff --git a/README.md b/README.md index fb137c23..76f153b8 100644 --- a/README.md +++ b/README.md @@ -115,8 +115,8 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用 21. 支持 Cloudflare Turnstile 用户校验。 22. 支持用户管理,支持**多种用户登录注册方式**: + 邮箱登录注册(支持注册邮箱白名单)以及通过邮箱进行密码重置。 - + 支持使用飞书进行授权登录。 - + [GitHub 开放授权](https://github.com/settings/applications/new)。 + + 支持[飞书授权登录](https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/authen-v1/authorize/get)。 + + 支持 [GitHub 授权登录](https://github.com/settings/applications/new)。 + 微信公众号授权(需要额外部署 [WeChat Server](https://github.com/songquanpeng/wechat-server))。 23. 支持主题切换,设置环境变量 `THEME` 即可,默认为 `default`,欢迎 PR 更多主题,具体参考[此处](./web/README.md)。 24. 配合 [Message Pusher](https://github.com/songquanpeng/message-pusher) 可将报警信息推送到多种 App 上。 diff --git a/controller/auth/lark.go b/controller/auth/lark.go index eb06dde9..39088b3c 100644 --- a/controller/auth/lark.go +++ b/controller/auth/lark.go @@ -40,7 +40,7 @@ func getLarkUserInfoByCode(code string) (*LarkUser, error) { if err != nil { return nil, err } - req, err := http.NewRequest("POST", "https://passport.feishu.cn/suite/passport/oauth/token", bytes.NewBuffer(jsonData)) + req, err := http.NewRequest("POST", "https://open.feishu.cn/open-apis/authen/v2/oauth/token", bytes.NewBuffer(jsonData)) if err != nil { return nil, err } diff --git a/web/berry/src/utils/common.js b/web/berry/src/utils/common.js index f9c2896c..bd85f8bf 100644 --- a/web/berry/src/utils/common.js +++ b/web/berry/src/utils/common.js @@ -95,7 +95,7 @@ export async function onLarkOAuthClicked(lark_client_id) { const state = await getOAuthState(); if (!state) return; let redirect_uri = `${window.location.origin}/oauth/lark`; - window.open(`https://open.feishu.cn/open-apis/authen/v1/index?redirect_uri=${redirect_uri}&app_id=${lark_client_id}&state=${state}`); + window.open(`https://accounts.feishu.cn/open-apis/authen/v1/authorize?redirect_uri=${redirect_uri}&client_id=${lark_client_id}&state=${state}`); } export async function onOidcClicked(auth_url, client_id, openInNewTab = false) { diff --git a/web/build.sh b/web/build.sh old mode 100644 new mode 100755