TikTok
Get your TikTok Credentials
To integrate with TikTok, you need to obtain API credentials by creating an application in the TikTok Developer Portal.
Follow these steps:
- Create an account on the TikTok Developer Portal
- Create a new application
- Set up a sandbox environment for testing
- Configure your redirect URL (must be HTTPS)
- Note your Client ID, Client Secret and Client Key
- 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 or another similar tool for this.
- For testing, you will need to use the Sandbox mode, which you can enable in the TikTok Developer Portal.
- The default scope is
user.info.profile
. For additional scopes, refer to the Available Scopes documentation.
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.
- The TikTok API does not provide email addresses. As a workaround, this implementation uses the user's
username
value for theemail
field, which is why it requires theuser.info.profile
scope instead of justuser.info.basic
. - For production use, you will need to request approval from TikTok for the scopes you intend to use.
Configure the provider
To configure the provider, you need to import the provider and pass it to the socialProviders
option of the auth instance.
Sign In with TikTok
To sign in with TikTok, you can use the signIn.social
function provided by the client. The signIn
function takes an object with the following properties:
provider
: The provider to use. It should be set totiktok
.