test / app.py
Vinayak221's picture
Update app.py
d2ed9d5 verified
from shiny import App, ui, render, reactive
import requests
# Define the UI layout
app_ui = ui.page_fluid(
ui.panel_title("Shiny App with Google OAuth"),
ui.layout_sidebar(
ui.sidebar(
ui.markdown(
"""
## Authentication Required
Please authenticate via Google to access the full features of this app.
[Click here to log in](http://localhost:5001/login)
After successful authentication, refresh this page.
"""
),
),
ui.main_panel(
ui.output_text("user_info"),
),
),
)
# Define the server logic
def server(input, output, session):
@output
@render.text
def user_info():
user_data = requests.get("http://flask_app:5001/user_info").json()
if user_data:
return f"Welcome, {user_data.get('name')}!"
else:
return "User not authenticated."
# Create the Shiny app
app = App(app_ui, server)
if __name__ == "__main__":
app.run(port=7860)