Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
API reference
tiktok

providers/tiktok

Built-in TikTok integration.

TiktokProfile

More info

Extends

  • Record<string, any>

Properties

data

data: {
  user: {
     avatar_large_url: string;
     avatar_url: string;
     avatar_url_100: string;
     bio_description: string;
     display_name: string;
     email: string;
     follower_count: number;
     following_count: number;
     is_verified: boolean;
     likes_count: number;
     open_id: string;
     profile_deep_link: string;
     union_id: string;
     username: string;
     video_count: number;
  };
};
user
user: {
  avatar_large_url: string;
  avatar_url: string;
  avatar_url_100: string;
  bio_description: string;
  display_name: string;
  email: string;
  follower_count: number;
  following_count: number;
  is_verified: boolean;
  likes_count: number;
  open_id: string;
  profile_deep_link: string;
  union_id: string;
  username: string;
  video_count: number;
};
user.avatar_large_url?
optional avatar_large_url: string;

User’s profile image with higher resolution

To return this field, add fields=avatar_url_100 in the user profile request’s query parameter.

user.avatar_url
avatar_url: string;

User’s profile image.

To return this field, add fields=avatar_url in the user profile request’s query parameter.

user.avatar_url_100?
optional avatar_url_100: string;

User`s profile image in 100x100 size.

To return this field, add fields=avatar_url_100 in the user profile request’s query parameter.

user.bio_description?
optional bio_description: string;

User’s bio description if there is a valid one.

To return this field, add fields=bio_description in the user profile request’s query parameter.

user.display_name
display_name: string;

User’s profile name

To return this field, add fields=display_name in the user profile request’s query parameter.

user.email?
optional email: string;
Note

Email is currently unsupported by TikTok

user.follower_count?
optional follower_count: number;

User’s followers count.

To return this field, add fields=follower_count in the user profile request’s query parameter.

user.following_count?
optional following_count: number;

The number of accounts that the user is following.

To return this field, add fields=following_count in the user profile request’s query parameter.

user.is_verified?
optional is_verified: boolean;

Whether TikTok has provided a verified badge to the account after confirming that it belongs to the user it represents.

To return this field, add fields=is_verified in the user profile request’s query parameter.

user.likes_count?
optional likes_count: number;

The total number of likes received by the user across all of their videos.

To return this field, add fields=likes_count in the user profile request’s query parameter.

user.open_id
open_id: string;

The unique identification of the user in the current application.Open id for the client.

To return this field, add fields=open_id in the user profile request’s query parameter.

user.profile_deep_link?
optional profile_deep_link: string;

The link to user’s TikTok profile page.

To return this field, add fields=profile_deep_link in the user profile request’s query parameter.

user.union_id?
optional union_id: string;

The unique identification of the user across different apps for the same developer. For example, if a partner has X number of clients, it will get X number of open_id for the same TikTok user, but one persistent union_id for the particular user.

To return this field, add fields=union_id in the user profile request’s query parameter.

user.username
username: string;

User’s username.

To return this field, add fields=username in the user profile request’s query parameter.

user.video_count?
optional video_count: number;

The total number of publicly posted videos by the user.

To return this field, add fields=video_count in the user profile request’s query parameter.

error

error: {
  code: string;
  log_id: string;
  message: string;
};
code
code: string;

The error category in string.

log_id
log_id: string;

The error message in string.

message
message: string;

The error message in string.


default()

default<P>(options): OAuthConfig<P>

Add TikTok login to your page.

Setup

Callback URL

https://example.com/api/auth/callback/tiktok

Configuration

import Auth from "@auth/core"
import TikTok from "@auth/core/providers/tiktok"
 
const request = new Request(origin)
const response = await Auth(request, {
  providers: [TikTok({ clientId: TIKTOK_CLIENT_KEY, clientSecret: TIKTOK_CLIENT_SECRET })],
})

Resources

Notes

💡

Production applications cannot use localhost URLs to sign in with TikTok. You need add the domain and Callback/Redirect url’s to your TikTok app and have them review and approved by the TikTok Team.

💡

Email address is not supported by TikTok.

💡

Client_ID will be the Client Key in the TikTok Application

By default, Auth.js assumes that the TikTok provider is based on the OAuth 2 specification.

💡

The TikTok provider comes with a default configuration. To override the defaults for your use case, check out customizing a built-in OAuth provider.

Disclaimer If you think you found a bug in the default configuration, you can open an issue.

Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec, we might not pursue a resolution. You can ask for more help in Discussions.

Type parameters

Type parameter
P extends TiktokProfile

Parameters

ParameterType
optionsOAuthUserConfig<P>

Returns

OAuthConfig<P>

Auth.js © Balázs Orbán and Team - 2024