开发者

XMLHttpRequest Basic Auth, second request

开发者 https://www.devze.com 2023-01-17 20:25 出处:网络
normally browser stores and adds authentication header automaticly after successfull authe开发者_如何学Gontication.

normally browser stores and adds authentication header automaticly after successfull authe开发者_如何学Gontication.

I have a XMLHttpRequest and added the authentication header for basic auth. No problem at all.

Then I try to send a second request to the same url that is basic http protected without adding manually the http request header to this request. Poorly it seems that the browser is not storing the authentication provided in request 1. My goal is to add the authentication handler transparently to every request that follows the first one (like a native browser do).

Any idea? Thanks.


Browser only storing authetication requested from user. So, if you send 1st request w/o authentication fields, browser will prompt user for auth this time, remember credentials and use it for next requests transparently.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号