Browse docsMenu

SDK

React Auth and Pod Access

Use AuthGuard and pod-access hooks to give apps a real request-access flow instead of a dead end.

Root guard

tsxcopy
import { AuthGuard } from "lemma-sdk/react";

export function App({ client }: { client: LemmaClient }) {
  return (
    <AuthGuard
      client={client}
      appName="Support Triage"
      appDescription="Route and resolve incoming customer requests."
    >
      <SupportTriageApp client={client} />
    </AuthGuard>
  );
}

What AuthGuard handles

  • Checks signed-in state through Lemma auth.
  • Uses pod membership when the client has a pod id.
  • Shows a polished app loader while auth and membership resolve.
  • Uses the host-injected app or widget name by default.
  • Shows app-aware sign-in, access request, pending, and retry states.
  • Rechecks pending access automatically and supports account switching.
  • Lets you theme or replace loading, unauthenticated, and access-request surfaces.

Headless pod access

tsxcopy
const access = usePodAccess({ client });

if (access.status === "missing") {
  return <button onClick={() => void access.requestAccess()}>Request access</button>;
}

return <span>{access.member?.roles?.join(", ") ?? "No pod role"}</span>;