import panel as pn
template = pn.template.FastListTemplate(
title="My App",
)
template.main.append(pn.pane.Markdown("## Main App"))
template_login = pn.template.FastListTemplate(
title="Login",
)
def login_view():
pn.state.location.pathname = '/main_app'
pn.state.location.reload = True
template_login.main.append(pn.pane.Markdown("Use the button below to login to the app using google account"))
button = pn.widgets.Button(name="Login", button_type="primary")
button.on_click(login_view)
template_login.main.append(button)
pn.serve(
{
"/": template_login,
"/main_app": template,
},
port=5006,
dev=True,
show=True,
websocket_origin="localhost:5006",
allow_websocket_origin=["localhost:5006"],
autoreload=False,
oauth_provider="google",
cookie_secret="xxxx",
oauth_key="xxx",
oauth_secret="xxxxx",
oauth_encryption_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
oauth_redirect_uri="/main_app",
)
I have the above app, I want to have a page where the user clicks on a button that directs him to the main app that cannot be accessed only after the users authenticate using their google account.
But this code does not work