-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Let JS client work with Gradio apps with auth #2266
Comments
Thanks for creating this issue @leszekhanusz and for providing the detailed JS code. @aliabid94 can you look at this, and is it possibly related to #1259? |
will take a look! |
In the meantime, as a workaround, I simply added an access code in the gradio inputs. |
I was stuck on this problem too and I found this thread https://github.com/gradio-app/gradio/discussions/444#discussioncomment-1993832. It looks like the recommended flow is to login through the UI, call If this is true, then I wonder if this token ever expires? And if it does, then can we programmatically get another token? edit: I looked at the endpoints in |
Hello @aliabid94 & @Fondson My gardio client javascript app has been stucked on login process too. |
Not at the moment sorry, we haven't had a chance to look into it. Contributions are welcome! |
I am trying to connect to a gradio backend which uses authentication (
auth
argument with login and password is set in thelaunch
method of my gradio interface).It works fine when I use my browser to login but I'm now trying to login through another page using javascript and I don't know how to proceed. The documentation about sharing your app explains how to activate this option but there is no explanation on how it works.
By looking at the network tab on Chrome, I was able to infer that you need to post formdata with
username
andpassword
to the/login
endpoint but if I do programmatically that I receive an html response.Here is my javascript code right now:
EDIT
By looking at the
/login/
path ingradio/routes.py
we have:So accessing
/login
redirects to/
and will set a http cookie with keyaccess-token
containing the login token.But we can see that the
httponly=True
is there, which will tell the browser not to provide the cookie when using fetch, in order to follow the CORS policy.So the question is now, is it possible to login to gradio through another origin when we use the auth parameter?
The text was updated successfully, but these errors were encountered: