Hi y’all,
I am currently trying to build a panel app with oauth and got it to work but can’t seem to figure out how to redirect back to the login page and clear the cookies. I am using the example from the docs.
import panel as pn
import os
APP_ROUTES = {
"/": pn.template.FastListTemplate(
main=pn.pane.Markdown(
"""
# My App
"""
)
).servable(),
}
def authorize(user_info):
with open('users.txt') as f:
valid_users = f.readlines()
return user_info['email'] in valid_users
pn.config.authorize_callback = authorize
pn.serve(
APP_ROUTES,
port=5000,
allow_websocket_origin=["0.0.0.0:5000"],
address="0.0.0.0",
show=False,
autoreload=True,
oauth_provider="google",
oauth_key=os.getenv("PANEL_OAUTH_KEY"),
oauth_secret=os.getenv("PANEL_OAUTH_SECRET"),
oauth_encryption_key=os.getenv("PANEL_OAUTH_ENCRYPTION"),
cookie_secret=os.getenv("PANEL_OAUTH_ENCRYPTION"),
)
It works great to not let users log in if they are not authorized and lets authorized users log in. But in the case where someone has lots of google accounts and accidentally clicks on the wrong one they either have to go into their browser and clear the cookies manually to be able to log in or wait until the cookie expires. Any thoughts?
Here is the page users get stuck on. Everytime I go back to my app it is stuck on this: