Chainlit / chainlit

Build Conversational AI in minutes ⚡️
https://docs.chainlit.io
Apache License 2.0
7.14k stars 937 forks source link

Issue on google Sign Automatically #1186

Open ismileb opened 3 months ago

ismileb commented 3 months ago

Path: /authentication/oauth

The thing is when we use oauth end point for the chainlit it automatically redirects from the login page of chainlit to google sign page. suggestion: It should ask the user to click the button for the google sign before the redirection for the google sign in. https://github.com/user-attachments/assets/55e21c76-1b46-4d78-8a90-0110521fb212 current senario to avoid automatically redirection i implemented password_auth_callback method which gives me a button for google sign .

ask senario: What if i want only google sign ? and want a button for it.

HadarSha commented 2 months ago

I am also experiencing this issue - Chainlit automatically redirects you within a second whether you even manage to take a quick look at the button or not. Ideally it should wait for the user to click the button before redirecting.

Also when you log out you automatically get redirected and logged back in - again, undesirable.

HoMi264 commented 2 months ago

I have the same issue but for Azure AD.

HadarSha commented 2 months ago

@HoMi264 FWIW, I can confirm that the workaround suggested by @ismileb works, I simply implemented the following (though it does add a dummy Email/Password-based login as well, that simply shouldn't let anyone in unless they use whatever oauth provider you're using):

@cl.password_auth_callback
def auth_callback(username: str, password: str) -> Optional[cl.User]:
    """
    Placeholder callback here only to prevent automatic redirection when using oauth provider.
    """
    return None
ismileb commented 2 months ago

@HadarSha FYI, this the not the solution which we are looking for! as i mentioned in open issue , there should be only google sign and want a button for it.

HadarSha commented 2 months ago

@HadarSha FYI, this the not the solution which we are looking for! as i mentioned in open issue , there should be only google sign and want a button for it.

Of course. But in case anyone's stumbled upon this issue, this helps mitigate it until this is properly resolved with only the oauth provider sign in (with this workaround at least you are not automatically redirected by default).

ismileb commented 2 months ago

@HadarSha FYI, this the not the solution which we are looking for! as i mentioned in open issue , there should be only google sign and want a button for it.

Of course. But in case anyone's stumbled upon this issue, this helps mitigate it until this is properly resolved with only the oauth provider sign in (with this workaround at least you are not automatically redirected by default).

Have you check any middleware for it?. As a i look around for it but haven't got any point to discuss. May be there can be any interrupts for google Sign-in.