feat: fix refresh token
This commit is contained in:
parent
0144e39841
commit
204739f049
|
|
@ -194,7 +194,7 @@ export async function postWorkflow({
|
|||
`Error posting on ${post.integration?.providerIdentifier} for ${post?.integration?.name}`,
|
||||
`An error occurred while posting on ${
|
||||
post.integration?.providerIdentifier
|
||||
}${err?.message ? `: ${err?.message}` : ``}`,
|
||||
}${err?.cause?.message ? `: ${err?.cause?.message}` : ``}`,
|
||||
true,
|
||||
false,
|
||||
'fail'
|
||||
|
|
|
|||
|
|
@ -63,10 +63,18 @@ export abstract class SocialAbstract {
|
|||
value = await func();
|
||||
} catch (err) {
|
||||
const handle = this.handleErrors(JSON.stringify(err));
|
||||
value = { err: true, ...(handle || {}) };
|
||||
value = { err: true, value: 'Unknown Error', ...(handle || {}) };
|
||||
}
|
||||
|
||||
if (value && value?.err && value?.value) {
|
||||
if (value.type === 'refresh-token') {
|
||||
throw new RefreshToken(
|
||||
'',
|
||||
JSON.stringify({}),
|
||||
{} as any,
|
||||
value.value || ''
|
||||
);
|
||||
}
|
||||
throw new BadBody('', JSON.stringify({}), {} as any, value.value || '');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,14 @@ export class YoutubeProvider extends SocialAbstract implements SocialProvider {
|
|||
};
|
||||
}
|
||||
|
||||
if (body.includes('Unauthorized')) {
|
||||
return {
|
||||
type: 'refresh-token',
|
||||
value:
|
||||
'Token expired or invalid, please reconnect your YouTube account.',
|
||||
};
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue