TikTok credentials¶
Agoras needs the following credentials from TikTok to be able to access its API:
Client Key (App ID)
Client Secret
TikTok Username
For that, we’ll need to create a TikTok for Developers app and get it approved for production use.
Important: TikTok requires app review and approval before you can use the API in production. The approval process can take several weeks. Additionally, TikTok’s API does not support like, share, or delete actions.
—
You can create a TikTok for Developers app at https://developers.tiktok.com/.
If you haven’t yet, you will need to apply for a TikTok for Developers account and create an application.
Apply for a TikTok for Developers account¶
Go to https://developers.tiktok.com/ and click “Get Started”
Sign in with your TikTok account (the same account you want to post to)
Complete the developer registration form:
Account Type: Select “Individual” unless you’re representing a company
Use Case: Select “Content Publishing” or “Marketing”
Contact Information: Provide accurate contact details
Company Information: Fill this if you selected “Company” as account type
Create an app¶
After your developer account is approved:
Go to your TikTok for Developers dashboard
Click “Create an app” or “Add app”
Fill out the application form:
App Name: Choose a descriptive name like “My-App-Agoras”
App Description: Describe your use case for content publishing
Category: Select “Productivity” or “Social Media”
Platform: Select “Web”
Configure app permissions¶
After creating your app:
Go to your app’s dashboard
Navigate to “Products” or “Add Products”
Add the following products to your app:
Login Kit: For user authentication
Content Posting API: For publishing videos and photos
Configure the required scopes:
user.info.basic: To get user profile informationvideo.upload: To upload video contentvideo.publish: To publish video content
Set up OAuth redirect URI¶
In your app dashboard, go to “Login Kit” settings
Add a redirect URI:
https://localhost:3456/callbackMake sure this exact URL is added to your app configuration
Submit for app review¶
Important: TikTok requires app review for production use.
Complete all required app information
Provide detailed use case description
Submit privacy policy and terms of service URLs (if required)
Submit your app for review
The review process typically takes 2-4 weeks. During this time, you can use your app in development mode with limited functionality.
Get your credentials¶
Once your app is created (and optionally approved):
Go to your app dashboard
Navigate to “Basic Information” or “App Details”
Copy the following credentials:
Client Key: Your app’s unique identifier
Client Secret: Your app’s secret key (keep this secure!)
Get your TikTok username¶
You’ll also need your TikTok username (the handle you want to post to):
Go to your TikTok profile
Your username is displayed as @username
Use just the username part (without the @)
For example, if your profile shows @myawesomehandle, use myawesomehandle
CI/CD Setup (Unattended Execution)¶
For CI/CD environments where interactive browser authorization isn’t possible, you can skip the authorize step entirely and provide all required credentials via environment variables.
Run
agoras tiktok authorizelocally first to generate a refresh token (one-time setup)Extract the refresh token using the tokens utility command:
# First, list tokens to find the identifier (if you don't know it) agoras utils tokens list --platform tiktok # Then view all stored credentials agoras utils tokens show --platform tiktok --identifier {identifier}
Set all required environment variables in your CI/CD pipeline:
export TIKTOK_USERNAME="your_username" export TIKTOK_CLIENT_KEY="your_client_key" export TIKTOK_CLIENT_SECRET="your_client_secret" export TIKTOK_REFRESH_TOKEN="your_refresh_token_here"
Run Agoras actions directly without running
authorize. All credentials will be loaded from environment variables.
Note: For unattended execution, you must provide all required credentials. The refresh token alone is not sufficient - you also need username, client key, and client secret as shown in the Platform Arguments and Environment Variables Reference documentation.
Development vs Production¶
Development Mode: - Available immediately after app creation - Limited to your own account - May have posting restrictions - Good for testing integration
Production Mode: - Requires app review and approval - Can post to any authorized account - Full API functionality - Required for live usage
Agoras parameters¶
TikTok credential |
Agoras parameter |
|---|---|
Client Key |
–client-key |
Client Secret |
–client-secret |
Username |
–username |
Note: After authorization, refresh tokens are managed automatically by Agoras. You no longer need to provide tokens for actions.
Troubleshooting¶
“App not approved” error: - Make sure your app has been submitted for review - Check if you’re trying to use production features in development mode - Verify all required app information is complete
“Invalid credentials” error:
- Double-check your Client Key and Client Secret
- Make sure you’re using the correct TikTok username
- Verify your app’s redirect URI is set to https://localhost:3456/callback
“Authorization failed” error: - Make sure you’re logged into the correct TikTok account - Check that your app has the required scopes enabled - Try the authorization process again
“Video upload failed” error: - Verify your video format is supported (MP4, MOV, WebM) - Check that your video duration doesn’t exceed account limits - Make sure your video file is accessible from the provided URL
For more help, consult the TikTok for Developers documentation.