# Support session banner

> A banner that tells the user a support agent is viewing the app as them, rendered on the server.

Source: https://bettersupabase.com/docs/registry/ui-recipes/support-session-banner

{/* Generated by scripts/build-recipes.ts from the example apps. Edit the examples or the script, then run `pnpm recipes`. */}

It loads its data on the server through the block's client; the [support-sessions block](https://bettersupabase.com/blocks/support-sessions) must be installed (`npx better-supabase add support-sessions`). Its page on bettersupabase.com is [/recipes/support-session-banner](https://bettersupabase.com/recipes/support-session-banner).

Web, with shadcn components:

```bash
npx shadcn add alert
```

```tsx title="apps/examples/nextjs/src/features/user/components/impersonation-banner.tsx"
import { LifeBuoyIcon } from "lucide-react";
import { getExtracted } from "next-intl/server";

import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";

import { getSession } from "../user-queries";

/**
 * Shown during a support session (`bs.startSupport`): staff see the app as the
 * user, and the audit log records who acted. Render inside `<Suspense>`.
 */
export async function ImpersonationBanner() {
  const [session, t] = await Promise.all([getSession(), getExtracted("user")]);

  if (session.kind !== "user" || !session.impersonator) {
    return null;
  }

  const { id, reason } = session.impersonator;

  return (
    <Alert variant="destructive" data-testid="impersonation">
      <LifeBuoyIcon />
      <AlertTitle>{t("Support session")}</AlertTitle>
      <AlertDescription>
        {reason
          ? t("Signed in by support ({id}): {reason}", { id, reason })
          : t("Signed in by support ({id}).", { id })}
      </AlertDescription>
    </Alert>
  );
}
```