Protect your vals behind a password. Use session cookies to persist authentication.
import { passwordAuth }
from "https://esm.town/v/pomdtr/password_auth?v=84";
export default passwordAuth(
() => {
return new Response(
"OK");
}, {
verifyPassword:
(password) => password ==
Deno.
env.
get(
"VAL_PASSWORD") });
If you want to use an api token to authenticate:
import { passwordAuth }
from "https://esm.town/v/pomdtr/password_auth?v=84";
import { verifyToken }
from "https://esm.town/v/pomdtr/verifyToken";
export default passwordAuth(
() => {
return new Response(
"OK");
}, {
verifyPassword: verifyToken });
How to sign out ?
Navigate to <your-site>/signout
.