Skip to content

Commit b177848

Browse files
Bill Leoutsakoscursoragent
authored andcommitted
fix(tiktok): stop returning raw 'credential' subBlock id from tools.config.params
The block's params function built a local `credential` variable from params.oauthCredential and returned it under the key `credential` in every switch case. That literal token is the raw subBlock id, which is deleted after canonical transformation into `oauthCredential` — the blocks.test.ts canonical-param-validation suite flags any params function that still references it. It was also redundant: oauthCredential is already part of the base resolved inputs, which the executor merges into the tool call before config.params overrides are applied, so the OAuth token resolution (which reads contextParams.oauthCredential) worked regardless. Removed the explicit credential plumbing, matching the convention already used by other OAuth blocks like dropbox.ts. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent d8608aa commit b177848

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

apps/sim/blocks/blocks/tiktok.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -379,37 +379,32 @@ export const TikTokBlock: BlockConfig<TikTokResponse> = {
379379
config: {
380380
tool: (params) => params.operation || 'tiktok_get_user',
381381
params: (params) => {
382-
const credential = params.oauthCredential
383382
const operation = params.operation || 'tiktok_get_user'
384383
const toBoolean = (value: unknown): boolean | undefined =>
385384
value === undefined || value === '' ? undefined : String(value).toLowerCase() === 'true'
386385

387386
switch (operation) {
388387
case 'tiktok_get_user':
389388
return {
390-
credential,
391389
...(params.fields && { fields: params.fields }),
392390
}
393391
case 'tiktok_list_videos':
394392
return {
395-
credential,
396393
...(params.maxCount && { maxCount: Number(params.maxCount) }),
397394
...(params.cursor && { cursor: Number(params.cursor) }),
398395
}
399396
case 'tiktok_query_videos':
400397
return {
401-
credential,
402398
videoIds: (params.videoIds || '')
403399
.split(',')
404400
.map((id: string) => id.trim())
405401
.filter(Boolean),
406402
}
407403
case 'tiktok_query_creator_info':
408-
return { credential }
404+
return {}
409405
case 'tiktok_direct_post_video': {
410406
const file = normalizeFileInput(params.file, { single: true })
411407
return {
412-
credential,
413408
source: params.videoSource || 'PULL_FROM_URL',
414409
videoUrl: params.videoUrl,
415410
file,
@@ -429,15 +424,13 @@ export const TikTokBlock: BlockConfig<TikTokResponse> = {
429424
case 'tiktok_upload_video_draft': {
430425
const file = normalizeFileInput(params.file, { single: true })
431426
return {
432-
credential,
433427
source: params.videoSource || 'PULL_FROM_URL',
434428
videoUrl: params.videoUrl,
435429
file,
436430
}
437431
}
438432
case 'tiktok_direct_post_photo':
439433
return {
440-
credential,
441434
photoImages: (params.photoImages || '')
442435
.split('\n')
443436
.map((url: string) => url.trim())
@@ -453,7 +446,6 @@ export const TikTokBlock: BlockConfig<TikTokResponse> = {
453446
}
454447
case 'tiktok_upload_photo_draft':
455448
return {
456-
credential,
457449
photoImages: (params.photoImages || '')
458450
.split('\n')
459451
.map((url: string) => url.trim())
@@ -464,11 +456,10 @@ export const TikTokBlock: BlockConfig<TikTokResponse> = {
464456
}
465457
case 'tiktok_get_post_status':
466458
return {
467-
credential,
468459
publishId: params.publishId,
469460
}
470461
default:
471-
return { credential }
462+
return {}
472463
}
473464
},
474465
},

0 commit comments

Comments
 (0)