π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
fix(tiktok-business): fail early when the OAuth redirect has no auth_code
Gilad Resisi15c4ce19cfba
diff --git a/libraries/nestjs-libraries/src/integrations/social/tiktok.business.provider.ts b/libraries/nestjs-libraries/src/integrations/social/tiktok.business.provider.tsindex 437030dc9..c231b2f47 100644--- a/libraries/nestjs-libraries/src/integrations/social/tiktok.business.provider.ts+++ b/libraries/nestjs-libraries/src/integrations/social/tiktok.business.provider.ts@@ -382,6 +382,18 @@ export class TiktokBusinessProvidercodeVerifier: string;refresh?: string;}) {+ // A redirect without an auth_code (consent declined or TikTok-side error)+ // otherwise reaches the token endpoint and fails as 40002 "Please provide+ // the auth_code", which hides the real cause in the logs.+ if (!params.code) {+ throw new BadBody(+ 'tiktok-business',+ JSON.stringify({ reason: 'no auth_code in the redirect' }),+ Buffer.from('{}'),+ 'TikTok did not return an authorization code, the authorization was not completed'+ );+ }+const response = await (await fetch(`${this.baseUrl}/tt_user/oauth2/token/`, {method: 'POST',