Has anyone implemented user authentication system to a static site (think: #Eleventy / #Hugo / anything that ends up as a bunch of HTML pages)?
I'd love to restrict access to one of my semi-public sites to a specific group of friends and assign them their own user-password pairs.
I'd love something nicer than plain .htpasswd.
I'd love it to be as plain and simple as possible. Only a login form. No user sign up, no password reminders. Maybe magic links via email or even static user-password pairs stored in a secure manner on some external backend server.
Of course, I want to self-host it, I want to spend as little time as possible maintaining it, but I could pay a reasonable sum for a nice out-of-the-box solution.
Any suggestions?
(I know Authorizer - https://authorizer.dev/ - but I wonder if there's anything else I haven't discovered)
@lukem Client-side it will be always a wash, if I had to do it I'd go for something simpler, a passphrase based descrambler. Add a tag to your static generator to take the content, AES it with a passphrase and base64 it to avoid browsers acting up. Dump it onto screen as is with "descramble". Grab the pass from user, get text from div, descramble, update and done.
@lukem > with "descramble" button
@lukem You can make add key to URL's partial if you want to distribute it in clickable form, but that's like leaking a passphrase (same with BASIC AUTH)
@lukem Going to be hard on a static website.
.htpasswd would allow you to send a link with username:password in the URL, so the user need only know that this is their special link. You’d need to be running Apache or similar to achieve this though (ie not a “serverless” solution like S3).
I guess you could write a bit of JavaScript that builds that URL for you from a static login page? Similarly, I guess you could also use JavaScript to echo back the username on the page, and a “log out” function that removes those from the URL.
@lukem @jcrabapple I think for the effort, using the .htpasswd is the easiest way to do this.
@lukem There’s this post, but it relies on Netlify and a Supabase account. https://11ty.rocks/posts/building-a-membership-site-with-11ty/
@bobmonsour catching up with notifications...
Thanks for this! Will have a look.