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

# TikTok

> Authenticate users with TikTok via the `oauth` plugin. Covers Login Kit setup, redirect URI configuration, and `user.info.basic` and `user.info.stats` scopes.

## Setup

<Steps>
  <Step>
    ### Get credentials

    Go to the [TikTok for Developers](https://developers.tiktok.com) portal and create an app. Under **Login Kit**, add your redirect URI:

    ```
    https://your-app.com/api/kavach/auth/oauth/callback/tiktok
    ```
  </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: 'tiktok',
              clientId: process.env.TIKTOK_CLIENT_ID!,
              clientSecret: process.env.TIKTOK_CLIENT_SECRET!,
            },
          ],
        }),
      ],
    });
    ```

    ```bash theme={"system"}
    TIKTOK_CLIENT_ID=...
    TIKTOK_CLIENT_SECRET=...
    ```
  </Step>
</Steps>

## Scopes

Default scopes: `user.info.basic`

| Scope               | What it unlocks           |
| ------------------- | ------------------------- |
| `user.info.basic`   | Display name and avatar   |
| `user.info.profile` | Profile URL and bio       |
| `user.info.stats`   | Follower and video counts |

<Info>
  TikTok Login Kit requires app review before production use. During development you can test with sandbox accounts added to your app's tester list.
</Info>

## Endpoints

| Method | Path                           | Description        |
| ------ | ------------------------------ | ------------------ |
| GET    | `/auth/oauth/authorize/tiktok` | Redirect to TikTok |
| GET    | `/auth/oauth/callback/tiktok`  | Handle callback    |
