feat(auth): implement JWT token refresh mechanism

This commit is contained in:
Ran
2026-02-24 04:21:18 +08:00
parent 5aefccd7cc
commit 52d4aee104
2 changed files with 6 additions and 5 deletions
+2 -1
View File
@@ -27,8 +27,9 @@ function parseJwtExp(token: string): number | null {
}
}
let refreshPromise: Promise<string> | null = null
export const createAuthFetcher = (auth: AgentAuthContext): AuthFetcher => {
let refreshPromise: Promise<string> | null = null
return async (url: string, options?: RequestInit) => {
if (auth.bearer) {
const exp = parseJwtExp(auth.bearer)