> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kavachos.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Human sign-in methods and OAuth providers for the humans who own and manage agents.

<Columns cols={2}>
  <div>
    KavachOS runs the sign-in for the humans who own agents. Each method is a plugin you opt into, use only what your app needs. Every provider is wired the same way in code.

    If you already run Clerk, Auth.js, or better-auth, keep them and skip the plugins. [Plug into an existing provider.](/migrate)
  </div>

  ```ts theme={"system"}
  import { createKavach } from 'kavachos';
  import { emailPassword, oauth } from 'kavachos/auth';

  const kavach = await createKavach({
    database: { provider: 'postgres', url: process.env.DATABASE_URL! },
    secret: process.env.KAVACH_SECRET!,
    baseUrl: 'https://auth.example.com',
    plugins: [
      emailPassword(),
      oauth({
        providers: [
          { id: 'google', clientId: process.env.GOOGLE_CLIENT_ID!, clientSecret: process.env.GOOGLE_CLIENT_SECRET! },
          { id: 'github', clientId: process.env.GITHUB_CLIENT_ID!, clientSecret: process.env.GITHUB_CLIENT_SECRET! },
        ],
      }),
    ],
  });
  ```
</Columns>

## Sign-in methods

<CardGroup cols={3}>
  <Card title="Email and password" icon="envelope" href="/auth/email-password">
    PBKDF2-SHA256 hashing, verification, reset.
  </Card>

  <Card title="Username and password" icon="user" href="/auth/username">
    For apps that prefer handles over email.
  </Card>

  <Card title="Magic link" icon="link" href="/auth/magic-link">
    One-time link in an email, no password.
  </Card>

  <Card title="Email OTP" icon="hashtag" href="/auth/email-otp">
    Six-digit code via email.
  </Card>

  <Card title="Phone OTP" icon="phone" href="/auth/phone">
    SMS code, any provider.
  </Card>

  <Card title="Passkey" icon="fingerprint" href="/auth/passkey">
    WebAuthn / FIDO2 biometrics and security keys.
  </Card>

  <Card title="Sign-in with Ethereum" icon="wallet" href="/auth/siwe">
    EIP-4361 wallet-based sign-in.
  </Card>

  <Card title="Device code" icon="tv" href="/auth/device">
    For TVs and CLIs that can't take a password.
  </Card>

  <Card title="Two-factor" icon="shield-halved" href="/auth/two-factor">
    TOTP with backup codes.
  </Card>

  <Card title="Captcha" icon="shield-check" href="/auth/captcha">
    Turnstile, hCaptcha, reCAPTCHA.
  </Card>

  <Card title="Anonymous" icon="user-secret" href="/auth/anonymous">
    Throwaway sessions, upgrade on sign-up.
  </Card>

  <Card title="Google One Tap" icon="hand-pointer" href="/auth/one-tap">
    Google's one-tap sign-in widget.
  </Card>

  <Card title="OAuth proxy" icon="arrows-left-right" href="/auth/oauth-proxy">
    Reverse-proxy mode for trusted ingress.
  </Card>
</CardGroup>

## OAuth providers

Thirty-eight first-class providers, plus a generic factory for anything with a standard authorization code flow.

<Tabs>
  <Tab title="Popular">
    <CardGroup cols={4}>
      <Card title="Google" icon="google" href="/auth/google" />

      <Card title="GitHub" icon="github" href="/auth/github" />

      <Card title="Apple" icon="apple" href="/auth/apple" />

      <Card title="Microsoft" icon="microsoft" href="/auth/microsoft" />

      <Card title="Discord" icon="discord" href="/auth/discord" />

      <Card title="Slack" icon="slack" href="/auth/slack" />

      <Card title="LinkedIn" icon="linkedin" href="/auth/linkedin" />
    </CardGroup>
  </Tab>

  <Tab title="Social">
    <CardGroup cols={4}>
      <Card title="Facebook" icon="facebook" href="/auth/facebook" />

      <Card title="X / Twitter" icon="twitter" href="/auth/twitter" />

      <Card title="Spotify" icon="spotify" href="/auth/spotify" />

      <Card title="Twitch" icon="twitch" href="/auth/twitch" />

      <Card title="Reddit" icon="reddit" href="/auth/reddit" />

      <Card title="TikTok" icon="tiktok" href="/auth/tiktok" />

      <Card title="Kakao" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/kakaotalk.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=49c244e07eaa609e1f41787f8521e42b" href="/auth/kakao" width="24" height="24" data-path="brand-icons/kakaotalk.svg" />

      <Card title="Naver" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/naver.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=4aefe652e3b8aa27b613847050c7d7eb" href="/auth/naver" width="24" height="24" data-path="brand-icons/naver.svg" />

      <Card title="VK" icon="vk" href="/auth/vk" />

      <Card title="Line" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/line.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=e42aad8d4c7bfc7699e90a89b18c7d18" href="/auth/line" width="24" height="24" data-path="brand-icons/line.svg" />

      <Card title="WeChat" icon="weixin" href="/auth/wechat" />

      <Card title="Kick" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/kick.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=67613eeddee4ed75ad87cf83b1eed97b" href="/auth/kick" width="24" height="24" data-path="brand-icons/kick.svg" />

      <Card title="Roblox" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/roblox.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=5a17b4e3e431a543179cbc704c023d67" href="/auth/roblox" width="24" height="24" data-path="brand-icons/roblox.svg" />
    </CardGroup>
  </Tab>

  <Tab title="Work">
    <CardGroup cols={4}>
      <Card title="Notion" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/notion.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=92a73e27704afa86e30e6d0be869cd33" href="/auth/notion" width="24" height="24" data-path="brand-icons/notion.svg" />

      <Card title="Figma" icon="figma" href="/auth/figma" />

      <Card title="Dropbox" icon="dropbox" href="/auth/dropbox" />

      <Card title="Zoom" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/zoom.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=04c3fec87e828ca01860cc99f19a8cec" href="/auth/zoom" width="24" height="24" data-path="brand-icons/zoom.svg" />

      <Card title="Atlassian" icon="atlassian" href="/auth/atlassian" />

      <Card title="Linear" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/linear.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=26e5b6df7ab3036f6a60da6664d61d84" href="/auth/linear" width="24" height="24" data-path="brand-icons/linear.svg" />

      <Card title="GitLab" icon="gitlab" href="/auth/gitlab" />

      <Card title="Bitbucket" icon="bitbucket" href="/auth/bitbucket" />

      <Card title="Salesforce" icon="salesforce" href="/auth/salesforce" />
    </CardGroup>
  </Tab>

  <Tab title="Developer">
    <CardGroup cols={4}>
      <Card title="Vercel" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/vercel.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=68a0b4a5c3a37893bc5ffcd116e4c266" href="/auth/vercel" width="24" height="24" data-path="brand-icons/vercel.svg" />

      <Card title="Railway" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/railway.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=bc25117876f078024a2eda2721609c57" href="/auth/railway" width="24" height="24" data-path="brand-icons/railway.svg" />

      <Card title="Hugging Face" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/huggingface.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=7bf5691f2fc33b75d7c670bea451c45a" href="/auth/huggingface" width="24" height="24" data-path="brand-icons/huggingface.svg" />
    </CardGroup>
  </Tab>

  <Tab title="Payments">
    <CardGroup cols={4}>
      <Card title="PayPal" icon="paypal" href="/auth/paypal" />

      <Card title="Coinbase" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/coinbase.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=012fd8f6e5d461096b7dd63362d9a282" href="/auth/coinbase" width="24" height="24" data-path="brand-icons/coinbase.svg" />

      <Card title="Polar" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/polar.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=fd807bdc49c1c7549b7b31d2cbf548c2" href="/auth/polar" width="300" height="300" data-path="brand-icons/polar.svg" />
    </CardGroup>
  </Tab>

  <Tab title="Enterprise">
    <CardGroup cols={4}>
      <Card title="Auth0" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/auth0.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=ff5cc5256e83d6663a01bb494d918611" href="/auth/auth0" width="24" height="24" data-path="brand-icons/auth0.svg" />

      <Card title="Okta" icon="https://mintcdn.com/glincker/HCepWcwRV4NkDcKv/brand-icons/okta.svg?fit=max&auto=format&n=HCepWcwRV4NkDcKv&q=85&s=e0623850c556ecb77f086093c03e2b6b" href="/auth/okta" width="24" height="24" data-path="brand-icons/okta.svg" />

      <Card title="Yahoo" icon="yahoo" href="/auth/yahoo" />
    </CardGroup>
  </Tab>
</Tabs>

<Tip>
  Don't see your provider? The [generic OAuth factory](/auth/oauth) wires any authorization-code provider in about ten lines of config.
</Tip>

## How plugins fit

Every plugin registers routes, tables, and session logic at `createKavach()` time. The resulting instance carries `auth.*` methods you call from your handlers.

```ts title="resolving a user from a request" theme={"system"}
const user = await kavach.auth.resolveUser(request);

if (!user) {
  return new Response('Unauthorized', { status: 401 });
}

// user.id is the stable owner ID for creating agents
```

<Info>
  Once the user is resolved, KavachOS is done with human auth. The rest of the stack (agents, permissions, audit) hangs off `user.id`.
</Info>

## Enterprise identity

<CardGroup cols={3}>
  <Card title="Organizations" icon="building" href="/auth/organizations">
    Multi-user accounts, roles, invitations.
  </Card>

  <Card title="SSO / SAML" icon="key" href="/auth/sso">
    SAML 2.0 and OIDC SSO.
  </Card>

  <Card title="SCIM" icon="arrows-rotate" href="/auth/scim">
    Automated provisioning from your IdP.
  </Card>

  <Card title="Admin plugin" icon="user-shield" href="/auth/admin">
    Ban, impersonate with TTL, audit.
  </Card>

  <Card title="API keys" icon="key-skeleton" href="/auth/api-keys">
    For machine-to-machine callers.
  </Card>

  <Card title="OIDC provider" icon="plug" href="/auth/oidc-provider">
    Turn your Kavach into an IdP for other apps.
  </Card>
</CardGroup>
