Wauplin HF staff commited on
Commit
bde0655
1 Parent(s): 3110228
Files changed (2) hide show
  1. app.py +2 -2
  2. auth.py +1 -1
app.py CHANGED
@@ -26,12 +26,12 @@ with gr.Blocks() as demo:
26
  # Taken from https://cmgdo.com/external-link-in-gradio-button/
27
  login_button = gr.Button("Login")
28
  login_button.click(
29
- None, None, None, _js="function() {location.replace('https://wauplin-gradio-oauth-test.hf.space/login/huggingface');}"
30
  )
31
 
32
  # Taken from https://cmgdo.com/external-link-in-gradio-button/
33
  logout_button = gr.Button("Logout", variant="secondary")
34
- logout_button.click(None, None, None, _js="function() {location.replace('https://wauplin-gradio-oauth-test.hf.space/logout');}")
35
 
36
  profile_btn = gr.Button("Show profile")
37
  output = gr.Markdown()
 
26
  # Taken from https://cmgdo.com/external-link-in-gradio-button/
27
  login_button = gr.Button("Login")
28
  login_button.click(
29
+ None, None, None, _js="function() {window.open('https://wauplin-gradio-oauth-test.hf.space/login/huggingface');}"
30
  )
31
 
32
  # Taken from https://cmgdo.com/external-link-in-gradio-button/
33
  logout_button = gr.Button("Logout", variant="secondary")
34
+ logout_button.click(None, None, None, _js="function() {window.open('https://wauplin-gradio-oauth-test.hf.space/logout');}")
35
 
36
  profile_btn = gr.Button("Show profile")
37
  output = gr.Markdown()
auth.py CHANGED
@@ -36,7 +36,7 @@ async def oauth_login(request: Request):
36
 
37
  async def oauth_logout(request: Request):
38
  request.session.pop("user", None)
39
- return RedirectResponse("/")
40
 
41
 
42
  async def oauth_redirect_callback(request: Request):
 
36
 
37
  async def oauth_logout(request: Request):
38
  request.session.pop("user", None)
39
+ return "logged out"
40
 
41
 
42
  async def oauth_redirect_callback(request: Request):