http basic authentication “log out”

前端 未结 8 1353
悲&欢浪女
悲&欢浪女 2020-11-28 04:23

HTTP basic authentication credentials are stored until the browser is closed, but is there a way to remove the credentials before the browser is closed?

I read about

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 04:58

    If you have control over the server code, you can create a "logout" function that replies "401 Unauthorized" regardless of the credentials given. This failure forces browsers to remove saved credentials.

    I just tested this with Chrome 34, IE 11, Firefox 25 - using Express.js server and HTTP basic authentication.

提交回复
热议问题