diff --git a/examples/descope_auth/main.py b/examples/descope_auth/main.py index 562799d37..3bb9f67f5 100755 --- a/examples/descope_auth/main.py +++ b/examples/descope_auth/main.py @@ -14,7 +14,7 @@ def login(): @user.page('/') def home(): - ui.markdown(f'```\n{json.dumps(user.about(),indent=2)}\n```') + ui.markdown(f'```\n{json.dumps(user.about(), indent=2)}\n```') ui.button('Logout', on_click=user.logout) diff --git a/examples/descope_auth/user.py b/examples/descope_auth/user.py index 8f5670537..8647fae43 100644 --- a/examples/descope_auth/user.py +++ b/examples/descope_auth/user.py @@ -23,11 +23,9 @@ def login_form() -> ui.element: def about() -> Dict[str, Any]: """Returns the user's Descope profile.""" - try: - return app.storage.user['descope'] - except AuthException: - logging.exception("Unable to load user.") - return {} + infos = app.storage.user['descope'] + if not infos: + raise Exception('User is not logged in.') async def logout() -> None: