# Sessions & roles

## Sessions

Sessions are standard Supabase sessions (`access_token` + `refresh_token`), persisted to `localStorage` by the browser client. The `_app` layout's `beforeLoad` redirects unauthenticated users to `/auth`.

## Sign out

Sign out calls both:

* `wallet.disconnect()` — clears wallet adapter state
* `supabase.auth.signOut()` — clears Supabase session

## Roles

Roles live in a separate `public.user_roles` table (never on `profiles`). Checks go through the `has_role(user_id, role)` security-definer function used by RLS policies.

Available roles:

* `requester` — submits items, assigned on signup by `handle_new_user`
* `reviewer` — works the queue
* `admin` — manages users and projects

See `src/components/RoleGate.tsx` for client-side role gating.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hitl-01.gitbook.io/hitl-docs/authentication/sessions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
