kavachOS
Authentication

TikTok

Sign in with TikTok using OAuth 2.0.

Setup

Get credentials

Go to the TikTok for Developers portal and create an app. Under Login Kit, add your redirect URI:

https://your-app.com/api/kavach/auth/oauth/callback/tiktok

Configure

lib/kavach.ts
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!,
        },
      ],
    }),
  ],
});
TIKTOK_CLIENT_ID=...
TIKTOK_CLIENT_SECRET=...

Scopes

Default scopes: user.info.basic

ScopeWhat it unlocks
user.info.basicDisplay name and avatar
user.info.profileProfile URL and bio
user.info.statsFollower and video counts

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

Endpoints

MethodPathDescription
GET/auth/oauth/authorize/tiktokRedirect to TikTok
GET/auth/oauth/callback/tiktokHandle callback

On this page