Skip to main content

get_user

Get the authenticated user. Triggers a login prompt if the user is not authenticated. Can be called inside __render__ or any registered function. Returns: UserClaims: User information with email (str) and roles (list[str]). Raises: GetUserFailed: If no valid authentication is found (results in HTTP 401). Example:


python from abstra.pages import register_function, get_user @register_function def __render__(): user = get_user() return f"<h1>Hello, {user.email}</h1>"

Return Value

abstra_internals.services.jwt.UserClaims