Skip to content

Commit de2a17a

Browse files
feat: enable TikTok content posting with PKCE and video.publish scope
1 parent b436e33 commit de2a17a

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

apps/sim/blocks/blocks/tiktok.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export const TikTokBlock: BlockConfig<TikTokResponse> = {
126126
{ label: 'Followers', id: 'FOLLOWER_OF_CREATOR' },
127127
{ label: 'Only Me', id: 'SELF_ONLY' },
128128
],
129-
value: () => 'PUBLIC_TO_EVERYONE',
129+
value: () => 'SELF_ONLY',
130130
condition: {
131131
field: 'operation',
132132
value: 'direct_post_video',

apps/sim/lib/auth/auth.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2505,12 +2505,13 @@ export const auth = betterAuth({
25052505
clientSecret: env.TIKTOK_CLIENT_SECRET as string,
25062506
authorizationUrl: 'https://www.tiktok.com/v2/auth/authorize/',
25072507
tokenUrl: `${getBaseUrl()}/api/auth/tiktok-token-proxy`,
2508-
scopes: ['user.info.basic', 'user.info.profile', 'user.info.stats', 'video.list'],
2508+
scopes: ['user.info.basic', 'user.info.profile', 'user.info.stats', 'video.list', 'video.publish'],
25092509
responseType: 'code',
2510+
pkce: true,
25102511
redirectURI: `${getBaseUrl()}/api/auth/oauth2/callback/tiktok`,
25112512
authorizationUrlParams: {
25122513
client_key: env.TIKTOK_CLIENT_KEY as string,
2513-
scope: 'user.info.basic,user.info.profile,user.info.stats,video.list',
2514+
scope: 'user.info.basic,user.info.profile,user.info.stats,video.list,video.publish',
25142515
},
25152516
getUserInfo: async (tokens) => {
25162517
const response = await fetch(

apps/sim/lib/oauth/oauth.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
812812
'user.info.profile',
813813
'user.info.stats',
814814
'video.list',
815+
'video.publish',
815816
],
816817
},
817818
},

apps/sim/tools/tiktok/direct_post_video.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ export const tiktokDirectPostVideoTool: ToolConfig<
8888
postInfo.title = params.title
8989
}
9090
if (params.disableDuet !== undefined) {
91-
postInfo.disable_duet = params.disableDuet
91+
postInfo.disable_duet = params.disableDuet === true || params.disableDuet === 'true'
9292
}
9393
if (params.disableStitch !== undefined) {
94-
postInfo.disable_stitch = params.disableStitch
94+
postInfo.disable_stitch = params.disableStitch === true || params.disableStitch === 'true'
9595
}
9696
if (params.disableComment !== undefined) {
97-
postInfo.disable_comment = params.disableComment
97+
postInfo.disable_comment = params.disableComment === true || params.disableComment === 'true'
9898
}
9999
if (params.videoCoverTimestampMs !== undefined) {
100100
postInfo.video_cover_timestamp_ms = params.videoCoverTimestampMs

0 commit comments

Comments
 (0)