Open htaccess password protectected page with no prompts

倖福魔咒の 提交于 2020-02-03 12:18:19

问题


I have a directory on a website that is password protected via htaccess. I want to be able to open this web page through my application without having the user enter the password but rather do it programatically.

For instance, is there a way I can embed the login information in the URL? Such as http://www.mypage.com/page.html?htaccesspassword=asdasdas

thanks!


回答1:


scheme://username:password@host/path



回答2:


Although I think that authentication through the URL, as described by Ignacio Vazquez-Abrams, is much simpler, another approach might be setting the Authorization header.

I'm assuming you're using Basic authentication.

The Authorization header looks something like this:

Authorization: Basic Base64EncodedCredentials

Where Base64EncodedCredentials is the username and password encoded with the Base 64 algorithm in the format

username:password

More information about it here: http://en.wikipedia.org/wiki/Basic_access_authentication



来源:https://stackoverflow.com/questions/9780656/open-htaccess-password-protectected-page-with-no-prompts

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