vez-untitled_tanhare.web.val.run
  • stevekrouse avatar
    blob_admin_blob
    @stevekrouse
    Forked from stevekrouse/blob_admin_home
    Script
  • stevekrouse avatar
    blob_admin_home
    @stevekrouse
    Forked from stevekrouse/sqlite_admin_tables
    Script
  • stevekrouse avatar
    html
    @stevekrouse
    An interactive, runnable TypeScript val by stevekrouse
    Script
  • pomdtr avatar
    basicAuth
    @pomdtr
    Val Town Basic Auth Add basic auth on top of any http val Usage Wrap your HTTP handler in the basicAuth middleware. import { basicAuth } from "https://esm.town/v/pomdtr/basicAuth"; function handler(req: Request) { return new Response("You are authenticated!"); } export default basicAuth(handler, { verifyUser: (username, password) => username == "user" && password == "password" }); If you want to use an apiToken as a password: import { basicAuth } from "https://esm.town/v/pomdtr/basicAuth"; import { verifyToken } from "https://www.val.town/v/pomdtr/verifyToken" function handler(req: Request) { return new Response("You are authenticated!"); } export default basicAuth(handler, { verifyUser: (_, password) => verifyToken(password) });
    Script
1
Next
December 14, 2023