Authentication
Call get_user() at the top of the script to require login. It triggers a login prompt if the user is not authenticated and returns an object with a .email attribute.
from abstra.forms import run, MarkdownOutput, get_user
user = get_user()
run([[MarkdownOutput(f"Hello, {user.email}!")]])
info
During local development, any email can be used to bypass the login prompt.
Filtering by the logged-in user
A common pattern is to fetch only the tasks or records that belong to the current user:
from abstra.forms import run, MarkdownOutput, get_user
from abstra.tasks import get_tasks
user = get_user()
all_pending_tasks = get_tasks()
my_pending_tasks = [t for t in all_pending_tasks if t["reviewer_email"].lower() == user.email.lower()]
if not my_pending_tasks:
run([[MarkdownOutput(f"No pending items for {user.email}.")]])
exit()