Skip to content Skip to sidebar Skip to footer

Http Basic Auth Logout

My server is running Apache and I used .htaccess for my basic auth. However, I want my users be able to cancel the auth (log out) with a button. Is it possible and how to do that?

Solution 1:

Basic Auth is not designed to manage log-out. If you would like to do it then you need to do the following:

1) Add a logout button to your page.

2) When user click on the log-out button send a blank username/password to the same URL as in case of normal log-in.

3) In the response you send back a “You have successfully logged out” page.

The original credentionals will be will overwriten with the empty (wrong) one.

Hope that it helps you.

Solution 2:

First of all, HTTP does not provide logout: HTTP/1.1. spec

But! You can redirect user to: http://newuser@www.example.com/

Post a Comment for "Http Basic Auth Logout"