basicauth-go
basicauth-go copied to clipboard
logout
How might I logout a user?
https://stackoverflow.com/questions/233507/how-to-log-out-user-from-web-site-using-basic-authentication
Basic Authentication wasn't designed to manage logging out. You can do it, but not completely automatically.
What you have to do is have the user click a logout link, and send a ‘401 Unauthorized’ in response, using the same realm and at the same URL folder level as the normal 401 you send requesting a login.
to be honest if you want logout you probably should add session/cookie based auth instead.
That's interesting, I'll give it a shot. I was wondering, because it seems browser might cache something? When I access the site with basic auth, the first time I enter username/password, then it no longer prompts until I clear browser cache or use a "private" browser window.