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.

Pages render without the player navbar, so login/logout are driven from the page's own HTML through the browser window.abstra API:

  • abstra.login() — send the user to the login screen (returns to the page).
  • abstra.logout() — clear the session and reload the page logged out.
  • abstra.logged() — returns true when a user is logged in (synchronous).

Raises:

GetUserFailed: If no valid authentication is found (results in HTTP 401).

Example:

from abstra.pages import register_function, get_user

@register_function
def __render__():
user = get_user()
return f'''
<h1>Hello, {user.email}</h1>
<button onclick="abstra.logout()">Sign out</button>
'''

Return Value

"UserClaims"