fix: refresh token

This commit is contained in:
Nevo David 2026-01-05 18:50:25 +07:00
parent 204739f049
commit dac6e8e189
3 changed files with 13 additions and 6 deletions

View File

@ -172,7 +172,7 @@ export async function postWorkflow({
err.cause.type === 'refresh_token'
) {
const refresh = await refreshToken(post.integration);
if (!refresh) {
if (!refresh || !refresh.accessToken) {
return false;
}
@ -286,7 +286,7 @@ export async function postWorkflow({
err.cause.type === 'refresh_token'
) {
const refresh = await refreshToken(post.integration);
if (!refresh) {
if (!refresh || !refresh.accessToken) {
return false;
}
@ -328,7 +328,7 @@ export async function postWorkflow({
err.cause.type === 'refresh_token'
) {
const refresh = await refreshToken(post.integration);
if (!refresh) {
if (!refresh || !refresh.accessToken) {
return false;
}

View File

@ -50,7 +50,7 @@ export class RefreshIntegrationService {
.refreshToken(integration.refreshToken)
.catch((err) => false);
if (!refresh) {
if (!refresh || !refresh.accessToken) {
await this._integrationService.refreshNeeded(
integration.organizationId,
integration.id

View File

@ -45,15 +45,22 @@ export class XProvider extends SocialAbstract implements SocialProvider {
value: string;
}
| undefined {
if (body.includes('usage-capped')) {
if (body.includes('Unsupported Authentication')) {
return {
type: 'refresh-token',
value: 'X authentication has expired, please reconnect your account',
};
}
if (body.includes('usage-capped')) {
return {
type: 'bad-body',
value: 'Posting failed - capped reached. Please try again later',
};
}
if (body.includes('duplicate-rules')) {
return {
type: 'refresh-token',
type: 'bad-body',
value:
'You have already posted this post, please wait before posting again',
};