# Session revocation

> session_active() for restrictive policies: false once the caller's session was signed out or expired, or the user was banned or deleted, so revoked access tokens stop working before they expire. options.policies writes the policy on every table.

- Category: Identity & access
- Module: `sessions`
- Modes: `managed`
- Docs: https://bettersupabase.com/docs/blocks/sessions
- Page: https://bettersupabase.com/blocks/sessions

## Install

```bash
npx better-supabase add sessions
```

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Modes: "managed". The default is "managed".
    sessions: { mode: "managed" },
  },
});
```

## Client

The React hooks are the registry item `@better-supabase/use-sessions` (`npx shadcn add @better-supabase/use-sessions`). They return data and actions and render no UI. Source: https://github.com/ScaleDockHQ/better-supabase/blob/main/packages/registry/items/hooks/use-sessions.ts

## Related blocks

Works with: [permissions](https://bettersupabase.com/blocks/permissions.md), [memberships](https://bettersupabase.com/blocks/memberships.md)

## Recipes

- [Sessions list](https://bettersupabase.com/recipes/sessions-list.md): The caller's signed-in devices with the last activity and a button to end each session.
