Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to logout of an HTTP authentication (htaccess) that works in Google Chrome?

I got a solution for Firefox and IE but I didn't find any solution for Google Chrome.

Is there a way to do it in Google Chrome?

like image 665
user983213 Avatar asked Oct 07 '11 00:10

user983213


1 Answers

I know it's a really old post... I mean like friggin 5 years now, but I just found a somewhat good solution.

Inside your protected folder, create another folder, let's call it "logout". Place the same .htaccess file in here as you have in your protected folder, except with a small modification. instead of:

Require valid-user

now write:

Require user EXIT

And make sure, you don't have a user named exit! :D

In your protected area, your logout link or button or whatever, should redirect the user to this address: example.com/protectedFolder/logout

The browsers usually are able to keep only one user logged in from one site name or realm name... the sign in attempt for the user Exit will overwrite everything, thus the originally logged in user, would have to log in again to the protected area.

But as always, I might be wrong, and you should still close all your browser window, and restart the computer if you want to be sure! :) Also, it wouldn't hurt, if you would tell your users what is going to happen, when they hit logout!

I have tested this in chrome and in internet explorer 11.(will not work in edge, and maybe others neither) The solution was found here: https://www.mavensecurity.com/media/BasicAuthLogOut.pdf

like image 100
Gyula Soós Avatar answered Sep 19 '22 12:09

Gyula Soós