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

This commit is contained in:
Nevo David 2025-07-11 12:37:05 +07:00
parent b8e3f53b23
commit 8b0994f8c7
1 changed files with 3 additions and 6 deletions

View File

@ -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[]) {