I am trying to fake bypass the browser basic authentication, and I don't really understand how this works.
我试图绕过浏览器基本身份验证,我真的不明白这是如何工作的。
I've seen some ways people deal with this basic authentication.
我已经看到人们处理这种基本身份验证的方式。
Basically the browser is asking me to enter a username and a password in the very beginning, but I want it to wait until the user enters an username and password in a <form>...</form>
.
基本上,浏览器要求我在一开始就输入用户名和密码,但我希望它等到用户在
I am actually trying to request some JSON files.
我实际上是在尝试请求一些JSON文件。
I've seen people using xhr.setRequestHeader
and/or ajax {method: GET}
, bu so far nothing worked for me.
我见过人们使用xhr.setRequestHeader和/或ajax {method:GET},到目前为止没有任何对我有用的东西。
How does this really work and in what order?
这是如何真正起作用的?
All right, I found my answer with arma's help. The "PUT" command is for modifying something. The "POST" command is for creating/adding something:
好吧,我在arma的帮助下找到了答案。 “PUT”命令用于修改某些内容。 “POST”命令用于创建/添加内容:
var mydata = {"fname":"bobworth"};
$.ajax({
type: "PUT",
processData : false,
data: JSON.stringify(mydata),
dataType: "json",
url: "http://www.example.com/users/",
contentType: "application/json; charset=utf-8",
username: "mark",
password: "123456",
success: function(t){ alert(t); },
error: function(jqXHR, textStatus, error){
alert("jqXHR:"+jqXHR.status+" txtStatus:"+textStatus+" Error:"+error); }
});
1 个解决方案
#1
0
Passing http-authenticate credentials to Ext.Ajax or Ext.data.Connection requests? looks like a good starting point.
将http-authenticate凭据传递给Ext.Ajax或Ext.data.Connection请求?看起来是一个很好的起点。
#1
0
Passing http-authenticate credentials to Ext.Ajax or Ext.data.Connection requests? looks like a good starting point.
将http-authenticate凭据传递给Ext.Ajax或Ext.data.Connection请求?看起来是一个很好的起点。