Recover invalid bot authentication
Check / deno (pull_request) Successful in 34s

This commit is contained in:
2026-09-14 16:39:33 +09:00
parent 419439baf6
commit 743c60e8a5
3 changed files with 86 additions and 15 deletions
+12
View File
@@ -0,0 +1,12 @@
export async function retryInvalidToken<
T extends { status: { success: boolean }; error: string },
>(attempt: () => Promise<T>, relogin: () => Promise<void>): Promise<T> {
let result = await attempt();
if (
!result.status.success && result.error.includes("invalid_refresh_token")
) {
await relogin();
result = await attempt();
}
return result;
}