> ## 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.

# Figma

> Authenticate users via Figma OAuth 2.0 with `figmaProvider`. Covers app registration, redirect URI setup, and the file read scope needed for design file access.

## Setup

<Steps>
  <Step>
    ### Get credentials

    Go to [figma.com/developers](https://www.figma.com/developers) and click **Create a new app**. Set the redirect URI to:

    ```
    https://your-app.com/api/kavach/auth/oauth/callback/figma
    ```
  </Step>

  <Step>
    ### Configure

    ```ts title="lib/kavach.ts" theme={"system"}
    import { createKavach } from 'kavachos';
    import { oauth } from 'kavachos/auth';
    import { figmaProvider } from 'kavachos/auth';

    const kavach = await createKavach({
      database: { provider: 'sqlite', url: 'kavach.db' },
      plugins: [
        oauth({
          providers: [
            figmaProvider(
              process.env.FIGMA_CLIENT_ID!,
              process.env.FIGMA_CLIENT_SECRET!,
            ),
          ],
        }),
      ],
    });
    ```

    ```bash theme={"system"}
    FIGMA_CLIENT_ID=...
    FIGMA_CLIENT_SECRET=...
    ```
  </Step>
</Steps>

## Scopes

Default scopes: `file_read`

| Scope       | What it unlocks                     |
| ----------- | ----------------------------------- |
| `file_read` | Read files, projects, and user info |

## Endpoints

| Method | Path                          | Description       |
| ------ | ----------------------------- | ----------------- |
| GET    | `/auth/oauth/authorize/figma` | Redirect to Figma |
| GET    | `/auth/oauth/callback/figma`  | Handle callback   |
