Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

feat: instagram returns refresh token, but it's actually that the user post too much

Nevo David8b0994f8c77b
diff --git a/libraries/nestjs-libraries/src/integrations/social.abstract.ts b/libraries/nestjs-libraries/src/integrations/social.abstract.ts
index 6bf2b69b4..00234ce2b 100644
--- a/libraries/nestjs-libraries/src/integrations/social.abstract.ts
+++ b/libraries/nestjs-libraries/src/integrations/social.abstract.ts
@@ -69,12 +69,9 @@ export abstract class SocialAbstract {
return this.fetch(url, options, identifier, totalRetries + 1);
}
- const handleError = this.handleErrors(json || '{}') || {
- type: 'bad-body',
- value: '',
- };
+ const handleError = this.handleErrors(json || '{}');
- if (request.status === 401 || handleError?.type === 'refresh-token') {
+ if (request.status === 401 && (handleError?.type === 'refresh-token' || !handleError)) {
console.log('refresh token', json);
throw new RefreshToken(
identifier,
@@ -84,7 +81,7 @@ export abstract class SocialAbstract {
);
}
- throw new BadBody(identifier, json, options.body!, handleError?.value);
+ throw new BadBody(identifier, json, options.body!, handleError?.value || '');
}
checkScopes(required: string[], got: string | string[]) {