lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design LLMs/AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Bedrock / Azure / Mistral / Perplexity ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT chat application.
https://chat-preview.lobehub.com
Other
34.84k stars 8.19k forks source link

[Request] Skip Auth.js sign-in page on SSO login if there is only one provider #1913

Open YangHanlin opened 3 months ago

YangHanlin commented 3 months ago

🥰 Feature Description

Currently, LobeChat sends the user to the sign-in page provided by Auth.js (e.g. the screenshot below) to select the provider to continue.

Screenshot

However, as LobeChat does not support email or credentials provider for now, if there's only one SSO provider configured, it does not make much sense to display a button for the user only to click again. I think it can be better to skip this page and redirect the user directly to the SSO provider if there is only one to choose from.

🧐 Proposed Solution

According to the docs, ID of the selected provider can be provided to calls to signIn() to skip the sign-in page and redirect to the OAuth2 provider directly.

I'll be happy to submit a PR if we can make this change.

📝 Additional Information

No response

lobehubbot commented 3 months ago

👀 @YangHanlin

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

arvinxx commented 3 months ago

I think it's better to skip choose If there's only one provider. But the implement method need to be think. Currently I prefer to get the enable provider with /api/config. And then add a new selector to pick the state. If the length of enabled provider = 1, than set it into Signin function.

YangHanlin commented 3 months ago

I think it's better to skip choose If there's only one provider. But the implement method need to be think. Currently I prefer to get the enable provider with /api/config. And then add a new selector to pick the state. If the length of enabled provider = 1, than set it into Signin function.

@arvinxx Thanks. Will try to implement.

cy948 commented 3 months ago

This change will require significant modifications to existing code and may introduce new rules for using login hooks. Please carefully consider the significance of this change and if necessary, please also change documentation for sso development in the PR.