Interactive app with Basic Authentication

I am trying to setup a new interactive app that is implemented as a web server that has HTTP Basic Authentication as the only auth option. It does have an option to completely disable auth and I’ve gotten everything working with that method, but I’d like to be able to add a layer of authentication for some security.
It looks like you need to send the username and password in a HTTP request header field and it looks like that can’t be done from the HTML form. There are posts online saying you should be able to do it with some Javascript and I have tried to implement that, but so far I haven’t gotten any of the examples I’ve found to work. Before I go too far down this rabbit hole I thought I’d see if anybody else has gotten Basic Auth working for any of their interactive apps.

In case you’re curious the app I’m working with here is agedu

  • agedu: track down wasted disk space
    The plan is to setup a cron job to index each users scratch directory on a daily basis and this app will allow them to start up a GUI so they can more easily find where all their old data is.

Yea it seems like in your view.html.erb you’d need a little javascript to intercept the click event and send a GET request with headers.

Here’s an example of setting a cookie in a view.html.erb.