docs: improve tiktok documentation (#1648)

This commit is contained in:
Dewin Umana
2025-03-03 02:17:31 -06:00
committed by GitHub
parent 122cb3627f
commit c385535a2c

View File

@@ -6,12 +6,26 @@ description: TikTok provider setup and usage.
<Steps>
<Step>
### Get your TikTok Credentials
Get your TikTok credentials from the [TikTok Developer](https://developers.tiktok.com/).
To integrate with TikTok, you need to obtain API credentials by creating an application in the [TikTok Developer Portal](https://developers.tiktok.com/apps).
Make sure to set the redirect URL to `http://localhost:3000/api/auth/callback/tiktok` for local development. For production, you should set it to the URL of your application. If you change the base path of the auth routes, you should update the redirect URL accordingly.
Follow these steps:
1. Create an account on the TikTok Developer Portal
2. Create a new application
3. Set up a sandbox environment for testing
4. Configure your redirect URL (must be HTTPS)
5. Note your Client ID, Client Secret and Client Key
<Callout type="info">
The TikTok API does not provide email addresses. As a workaround, the user's `email` field uses the `preferred_username` value instead.
- The TikTok API does not work with localhost. You need to use a public domain for the redirect URL and HTTPS for local testing. You can use [NGROK](https://ngrok.com/) or another similar tool for this.
- For testing, you will need to use the [Sandbox mode](https://developers.tiktok.com/blog/introducing-sandbox), which you can enable in the TikTok Developer Portal.
- The default scope is `user.info.profile`. For additional scopes, refer to the [Available Scopes](https://developers.tiktok.com/doc/tiktok-api-scopes/) documentation.
</Callout>
Make sure to set the redirect URL to a valid HTTPS domain for local development. For production, you should set it to the URL of your application. If you change the base path of the auth routes, you should update the redirect URL accordingly.
<Callout type="info">
- The TikTok API does not provide email addresses. As a workaround, this implementation uses the user's `username` value for the `email` field, which is why it requires the `user.info.profile` scope instead of just `user.info.basic`.
- For production use, you will need to request approval from TikTok for the scopes you intend to use.
</Callout>
</Step>
@@ -27,6 +41,7 @@ description: TikTok provider setup and usage.
tiktok: { // [!code highlight]
clientId: process.env.TIKTOK_CLIENT_ID, // [!code highlight]
clientSecret: process.env.TIKTOK_CLIENT_SECRET, // [!code highlight]
clientKey: process.env.TIKTOK_CLIENT_KEY, // [!code highlight]
}, // [!code highlight]
},
})