Skip to content

Working with the authenticated user

Greg Bowler edited this page Nov 1, 2026 · 2 revisions

After authentication, AuthUser gives our application a small identity object without exposing tokens or response ciphers. These examples run inside a handler from the Quick start guide.

Protecting a page

if (!auth.isLoggedIn()) auth.login();
const user = auth.getAuthUser();

The default redirect handler throws a control-flow signal. Runtime adapters catch it and send the redirect; execution does not continue into protected content. A custom redirect handler must preserve this behavior. Reading a user while logged out throws NotLoggedInException.

Identifying a user

const { id, email } = auth.getAuthUser();

Use the provider ID to associate local records. Email can change. Both properties are read-only. Updating local application data does not update the provider.

Keeping permissions in the application

Login identifies a visitor. The application must still check access to each private record or action, for example by loading an order using both its ID and the authenticated user's ID.


Next, see Responding to a new authentication.

Clone this wiki locally