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/tiktokConfigure
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
| 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 |
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
| Method | Path | Description |
|---|---|---|
| GET | /auth/oauth/authorize/tiktok | Redirect to TikTok |
| GET | /auth/oauth/callback/tiktok | Handle callback |