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">
      <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 branded sign-in fallback when unauthenticated.
  • Shows request-access UI when signed in but not a pod member.
  • Lets you pass custom loading, unauthenticated, or access-request fallbacks.

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>;