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
Fix OAuth + fix OAuth documentation + undocument logout button #7697
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/6ef5b2640fbdc37510fa11eed1b0f00875fdaf32/gradio-4.21.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@6ef5b2640fbdc37510fa11eed1b0f00875fdaf32#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
Thanks @Wauplin for this PR! Taking a look now
That's really strange. I don't think #7557 should have affected |
@Wauplin are you sure that OAuth was broken? I just tested here with the version on |
@@ -82,6 +82,11 @@ def __contains__(self, item) -> bool: | |||
return True | |||
return False | |||
|
|||
def get(self, item, default=None): |
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.
Trying to understand if we need this? Where do we call .get()
on the request object? Note that we already have a __getitem__
which should provide a basic way to let this class be used as a dictionary
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.
(see #7697 (comment))
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.
@Wauplin this PR looks good and I've confirmed that OAuth continues to work: https://huggingface.co/spaces/abidlabs/oauth_test4
That being said, I can't repro OAuth being broken in the first place. Would be good to clarify that before merging in.
@abidlabs here is an example running on Gradio 4.21.0: https://huggingface.co/spaces/Wauplin/tmp_test_oauth. I'm getting an error when Gradio internals try to get oauth information from Here is the traceback that helped me debug it:
By a quick git blame, it looks like this line has been updated here (in #7495, 3 weeks ago). |
Ah that explains it. We refactored this assuming that request.session is a dictionary. Nice catch @Wauplin and thanks for explaining. We'll get a release out soon. |
I was also expecting it to be a dictionary 😁 |
2 things in this PR:
gr.LogoutButton
breaks app #7695. The snippet example in the OAuth docs is not complete, resulting in a runtime error when running it. I forgotfrom huggingface_hub import whoami
anddemo.launch()
. This is now fixed and I've been able to run it both locally and in a Space. I also took the opportunity to remove mentions togr.LogoutButton
from the docs (deprecated in Single oauth button #7063).request.session
is not a dictionary anymore but aObj
object that mimics it. TheObj
class has been added 6 months ago but the bug is for sure much more recent. Can it be related to Allow mounted Gradio apps to work with external / arbitrary authentication providers #7557 cc @abidlabs? In any case, I've added aget
method toObj
which solved the issue.I think that once this PR is merged, we should make a follow-up release given that it affects all oauth apps running on the latest version of Gradio 😕
cc @pngwn who pinged me on this.