How to display HTTP 401 basic authentication dialog

被刻印的时光 ゝ 提交于 2019-12-01 11:41:21

You just need to send the appropriate headers when a client requests a resource you want to require authentication for.

HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="Restricted Area"

The client can then retry the request while sending a base64 encoded header in the format username:password.

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

See also: http://en.wikipedia.org/wiki/Basic_access_authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!