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

# Linear

> Authenticate users via Linear OAuth 2.0. Register an OAuth application, configure the `linear` provider, and request `read` or `write` scopes as needed.

## Setup

<Steps>
  <Step>
    ### Get credentials

    Go to [linear.app/settings/api](https://linear.app/settings/api) and click **Create new OAuth application**. Add your redirect URI:

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

  <Step>
    ### Configure

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

    const kavach = await createKavach({
      database: { provider: 'sqlite', url: 'kavach.db' },
      plugins: [
        oauth({
          providers: [
            {
              id: 'linear',
              clientId: process.env.LINEAR_CLIENT_ID!,
              clientSecret: process.env.LINEAR_CLIENT_SECRET!,
            },
          ],
        }),
      ],
    });
    ```

    ```bash theme={"system"}
    LINEAR_CLIENT_ID=...
    LINEAR_CLIENT_SECRET=...
    ```
  </Step>
</Steps>

## Scopes

Default scopes: `read`

| Scope              | What it unlocks                        |
| ------------------ | -------------------------------------- |
| `read`             | Read access to the user's data         |
| `write`            | Write access to issues, comments, etc. |
| `issues:create`    | Create issues                          |
| `app:assignIssues` | Assign issues to the app               |

<Info>
  Linear uses UUIDs as user identifiers. The user's email is always returned and is verified.
</Info>

## Endpoints

| Method | Path                           | Description        |
| ------ | ------------------------------ | ------------------ |
| GET    | `/auth/oauth/authorize/linear` | Redirect to Linear |
| GET    | `/auth/oauth/callback/linear`  | Handle callback    |
