Protect your vals behind a password. Use session cookies to persist authentication.
See @pomdtr/password_auth_test
If you want to use an api token to authenticate:
import { passwordAuth } from "https://esm.town/v/pomdtr/password_auth";
export default passwordAuth(() => {
return new Response("OK");
});
Or if you prefer to use a string:
import { passwordAuth } from "https://esm.town/v/pomdtr/password_auth";
export default passwordAuth(() => {
return new Response("OK");
}, { password: Deno.env.get("MY_PASSWORD") });
Or if you want to share your val with someone without sharing your main password, you can set multiple ones
import { passwordAuth } from "https://esm.town/v/pomdtr/password_auth";
export default passwordAuth(() => {
return new Response("OK");
}, { password: [Deno.env.get("MY_PASSWORD"), Deno.env.get("STEVE_PASSWORD")] });
Note that authenticating using your api token is always an option.
How to sign out ?
Navigate to <your-site>/signout
.
Migrated from folder: Archive/password_auth