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

# Atlassian

> Authenticate users via Atlassian OAuth 2.0 with `atlassianProvider`. Covers Jira and Confluence accounts, token refresh, and scope configuration for Atlassian APIs.

## Setup

<Steps>
  <Step>
    ### Get credentials

    Go to the [Atlassian Developer Console](https://developer.atlassian.com) and create an OAuth 2.0 app. Add your redirect URI:

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

  <Step>
    ### Configure

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

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

    ```bash theme={"system"}
    ATLASSIAN_CLIENT_ID=...
    ATLASSIAN_CLIENT_SECRET=...
    ```
  </Step>
</Steps>

## Scopes

Default scopes: `read:me`, `offline_access`

| Scope                  | What it unlocks           |
| ---------------------- | ------------------------- |
| `read:me`              | Read the user's profile   |
| `offline_access`       | Refresh token support     |
| `read:jira-user`       | Read Jira user info       |
| `read:confluence-user` | Read Confluence user info |

<Info>
  Atlassian uses a 3-legged OAuth (3LO) flow. Users grant access per product (Jira, Confluence, etc.). The accessible resources endpoint returns which sites the user has authorized.
</Info>

## Endpoints

| Method | Path                              | Description           |
| ------ | --------------------------------- | --------------------- |
| GET    | `/auth/oauth/authorize/atlassian` | Redirect to Atlassian |
| GET    | `/auth/oauth/callback/atlassian`  | Handle callback       |
