GuidesAuth Providers
TikTok Auth
Add TikTok OAuth sign-in to your app.
Docs are in beta — content is improving rapidly. Found something missing? Open an issue on GitHub or reach out on Twitter (X).
Important: TikTok requires HTTPS — it does not work on
http://localhost. Use ngrok or a staging environment for testing. TikTok also usesclientKey(notclientId) — this is handled automatically by BetterStarter.
Note: TikTok does not provide email addresses. The user's
usernameis used as a fallback for the email field. Theuser.info.profilescope is required for this to work.
1. Create a TikTok App
- Go to the TikTok Developer Portal and click Manage Apps → Create App
- Fill in the app details
- Enable a Sandbox environment for testing
- Under Login Kit, configure your Redirect URI (must be HTTPS):
https://yourdomain.com/api/auth/callback/tiktok
- After saving, copy the Client Key and Client Secret from the app settings
For local development, use a tool like ngrok to expose your local server over HTTPS, then add the ngrok URL as a redirect URI.
2. Set Environment Variables
# .env.local
# Note: TikTok uses TIKTOK_CLIENT_KEY (not CLIENT_ID)
TIKTOK_CLIENT_KEY=your-client-key
TIKTOK_CLIENT_SECRET=your-client-secret3. Enable in Config
In src/appConfig.ts set:
tiktok: { enabled: true },4. Test
Deploy to a staging environment with HTTPS and navigate to /auth/sign-in. A Sign in with TikTok button will appear.
Production Checklist
- Request production access for the scopes your app uses in the TikTok Developer Portal
- Add your production redirect URI to the app configuration
Troubleshooting
redirect_uri_mismatch— TikTok requires the redirect URI to exactly match and be HTTPS- No email on user — this is expected; TikTok doesn't provide emails. The username is used as a stand-in
- No TikTok button — check
TIKTOK_CLIENT_KEYandTIKTOK_CLIENT_SECRETare set andtiktok.enabledistrue