401 reauth experiments

This commit is contained in:
Igor Loskutov
2025-09-05 14:20:00 -04:00
parent 01c969b8a9
commit 2e94f4ccbe
4 changed files with 79 additions and 14 deletions

View File

@@ -25,15 +25,16 @@ export function SessionAutoRefresh({ children }) {
const interval = setInterval(() => {
if (accessTokenExpires !== null) {
const timeLeft = accessTokenExpires - Date.now();
if (timeLeft < REFRESH_BEFORE) {
auth
.update()
.then(() => {})
.catch((e) => {
// note: 401 won't be considered error here
console.error("error refreshing auth token", e);
});
}
console.log("time left", timeLeft);
// if (timeLeft < REFRESH_BEFORE) {
// auth
// .update()
// .then(() => {})
// .catch((e) => {
// // note: 401 won't be considered error here
// console.error("error refreshing auth token", e);
// });
// }
}
}, INTERVAL_REFRESH_MS);