-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
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
Feishu auth provider #6386
base: main
Are you sure you want to change the base?
Feishu auth provider #6386
Conversation
Someone is attempting to deploy a commit to the LobeChat Desktop Team on Vercel. A member of the Team first needs to authorize it. |
Thank you for raising your pull request and contributing to our Community |
请给出流程demo 演示哈,可以是录屏 |
Please give a demo process, it can be a screen recording |
20250221143449.webm |
20250221143449.webm |
接入文档需要补一下
|
src/config/auth.ts
Outdated
@@ -269,6 +277,10 @@ export const getAuthConfig = () => { | |||
|
|||
// Casdoor | |||
CASDOOR_WEBHOOK_SECRET: process.env.CASDOOR_WEBHOOK_SECRET, | |||
|
|||
// feishu | |||
FEISHU_APP_ID: process.env.FEISHU_APP_ID, |
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.
clientId 和 secret 的环境变量命名对齐一下 environment variable inference 。 https://authjs.dev/getting-started/deployment
飞书 和 Lark 同理吗?日常在用 Lark 办公,命名上是不是可以考虑 下 Lark |
Are Feishu and Lark the same? When using Lark for daily use, can you consider Lark? |
有什么建议吗? |
Any suggestions? |
看大佬们的吧,可以忽略我,感觉 lark 和飞书 应该只是请求URL 上的区别 |
Look at the big guys, you can ignore me. I feel that the difference between lark and Feishu should be just the request URL |
他们本身是标准的 oAuth 协议,这个 pr 也只是增加了一些 auth.js 配置,混在一起可能还更容易引起歧义。 |
They themselves are the standard oAuth protocol, and this pr only adds some auth.js configuration, which may be more likely to cause ambiguity when mixed together. |
可以试试里面的generic oidc provider能不能兼容,那是标准的实现。 |
You can try whether the generic oidc provider is compatible, which is a standard implementation. |
官方没有文档说明支持 oidc,实际测试发现飞书不支持(不支持 well-know 协议 |
There is no official documentation to support oidc. In actual testing, it was found that Feishu does not support it (it does not support the well-know protocol. |
|
||
## feishu | ||
|
||
### `FEISHU_APP_ID` |
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.
文档的变量名对齐一下 authjs 的规范呗
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.
文档正在补齐。我把 PR 标记为 draft 了。
provider: Feishu(), | ||
}; | ||
|
||
export default provider; |
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.
参照 https://github.com/lobehub/lobe-chat/blob/main/src/libs/next-auth/sso-providers/logto.ts 的实现,把代码重构一下,先写基础的 Provider,最后在 function 入参的地方通过环境变量传入 app id, secret 等。 环境变量只需要 process.env.AUTH_[provider id ]_ID
这个,前面的就不需要加了,前面的写法在 2.0 会废弃的。
lobe-chat/src/libs/next-auth/sso-providers/logto.ts
Lines 38 to 48 in 69f8555
provider: LobeLogtoProvider({ | |
authorization: { | |
params: { scope: 'openid offline_access profile email' }, | |
}, | |
// 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, | |
}), | |
}; |
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.
process.env.AUTH_[provider id ]_ID 环境变量会被 auth.js 自动读取。还需要显示传入吗? @cy948
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.
把scope和profile处理函数显式声明一下
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
增加飞书 oAuth 登录
📝 补充信息 | Additional Information