fix: refresh token
This commit is contained in:
parent
204739f049
commit
dac6e8e189
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue