Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Cleanup oauth tokens cache

Chocobozzz81c647ff1916
diff --git a/server/lib/auth.ts b/server/lib/auth.ts
index 7c1dd1139b..8579bdbb44 100644
--- a/server/lib/auth.ts
+++ b/server/lib/auth.ts
@@ -105,6 +105,14 @@ async function onExternalUserAuthenticated (options: {
authName
})
+ // Cleanup
+ const now = new Date()
+ for (const [ key, value ] of authBypassTokens) {
+ if (value.expires.getTime() < now.getTime()) {
+ authBypassTokens.delete(key)
+ }
+ }
+
res.redirect(`/login?externalAuthToken=${bypassToken}&username=${user.username}`)
}