diff --git a/packages/http/src/server.tsx b/packages/http/src/server.tsx index 622ad43..b903680 100644 --- a/packages/http/src/server.tsx +++ b/packages/http/src/server.tsx @@ -91,10 +91,7 @@ const requireAuth = (handler: (req: Request) => Response | Promise) => return handler(req) } - const auth = req.headers.get("authorization") - const correctAuth = `Basic ${btoa("spike:888")}` - - if (auth === correctAuth) { + if (validAuth(req)) { const response = await handler(req) const newHeaders = new Headers(response.headers) @@ -121,3 +118,9 @@ const requireAuth = (handler: (req: Request) => Response | Promise) => }) } } + +const validAuth = (req: Request): boolean => { + const logins = ["spike:888", "defunkt:888", "probablycorey:888"] + const auth = req.headers.get("authorization") + return logins.some((login) => `Basic ${btoa(login)}` === auth) +}