Ajax jQuery 401未经授权


                    

我正在使用Wowza流媒体平台。 我想使用Wowza API录制API。 当我在网络浏览器中键入时,它运行良好。
我正在Web浏览器中使用此链接</ p>

  http:// username:password@myurl.com:8086 / livestreamrecord?app = live&streamname = myStream&action = startRecording
</ code> </ pre>

但是,当我在AJAX中使用时,弹出的提示我不希望发生。</ p>

  $。ajax({
     异步:false,
     url:“ myurl.com:8086/livestreamrecord?app=live&streamname=myStream&action=startRecording”,
     类型:“ GET”,
     dataType:“ jsonp”,
     beforeSend:函数(xhr){
         xhr.setRequestHeader('Authorization',“ Any” + btoa(user +“:” + password));
     },
     })。done(function(response){
             alert(“ RECORDING ..”);

});
</ code> </ pre>

虽然username:password @附加在URL ajax中的链接对我不起作用。 它产生了401个未经授权的错误。 我不希望出现提示输入身份验证信息的内容,而是希望在没有用户知识的情况下直接获得直接授权。</ p>
     </ div>

展开原文

原文

I'm working with Wowza streaming platform. I would like to use Wowza API recording API. It works well when I type in web browser. I'm using this link in my Web browser

http://username:password@myurl.com:8086/livestreamrecord?app=live&streamname=myStream&action=startRecording

However, when I used in AJAX called, the prompt pop out which I don't want that to happen.

$.ajax({
    async : false,
    url : "myurl.com:8086/livestreamrecord?app=live&streamname=myStream&action=startRecording",
    type : 'GET',
    dataType: "jsonp",
    beforeSend: function (xhr) {
        xhr.setRequestHeader('Authorization', "Any " + btoa(user+":"+password));
    },
    }).done(function(response){
            alert("RECORDING..");

});

Though username:password@ append in the link in url ajax wouldn't work for me. It produced 401 unauthorised error. I don't want something that prompt out ask for authentication informations but straight direct authorisation without user knowledge.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问