feat: fix refresh token
This commit is contained in:
parent
c7b83ee361
commit
fc349942b5
|
|
@ -135,8 +135,9 @@ export abstract class SocialAbstract {
|
|||
}
|
||||
|
||||
if (
|
||||
request.status === 401 &&
|
||||
(handleError?.type === 'refresh-token' || !handleError)
|
||||
(request.status === 401 &&
|
||||
(handleError?.type === 'refresh-token' || !handleError)) ||
|
||||
handleError?.type === 'refresh-token'
|
||||
) {
|
||||
throw new RefreshToken(
|
||||
identifier,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,19 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider {
|
|||
return 500;
|
||||
}
|
||||
|
||||
override handleErrors(body: string):
|
||||
| {
|
||||
type: 'refresh-token' | 'bad-body';
|
||||
value: string;
|
||||
}
|
||||
| undefined {
|
||||
if (body.includes('Error validating access token')) {
|
||||
return { type: 'refresh-token', value: 'Threads access token expired' };
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async refreshToken(refresh_token: string): Promise<AuthTokenDetails> {
|
||||
const { access_token } = await (
|
||||
await this.fetch(
|
||||
|
|
|
|||
Loading…
Reference in New Issue